There are other places your application might be opening files than
just URLConnection... for example every Runtime.exec() costs 3 open
files.
To check the limit, use "ulimit -a" or "ulimit -n" in the shell.
This isn't a solution, but you can increase the limit by running
"ulimit -n someNumber" in the shell before running the application, or
put the command in your .bash_profile or similar place so it runs
every time you login.
The solution is to find out what files your application isn't closing,
and make sure you close them. You can do that by doing "ls -l" in
/proc/NN/fd, or running lsof on the process.
回复 更多评论