jojo's blog--快乐忧伤都与你同在
为梦想而来,为自由而生。 性情若水,风起水兴,风息水止,故时而激荡,时又清平……
posts - 11,  comments - 30,  trackbacks - 0

Increase file descriptor limit under Linux to prevent

java.net.SocketException: Too many open files

Get current limit:

ulimit -n

cat /proc/sys/fs/file-nr

The default limit is 1024.

Get current number of open file descriptors:

lsof [-p pid] | wc -l

Increase the limit:

Edit /etc/security/limits.conf:

username hard nofile 32768

posted on 2009-04-14 10:53 Blog of JoJo 阅读(989) 评论(2)  编辑  收藏 所属分类: Linux 技术相关

FeedBack:
# re: Increase file descriptor limit under Linux to prevent java.net.SocketException: Too many open files
Increase file descriptor limit under Linux to prevent java.net.SocketException: Too many open files
Increase file descriptor limit under Linux to
2009-04-14 10:57 | Blog of JoJo
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.  回复  更多评论
  
# re: Increase file descriptor limit under Linux to prevent java.net.SocketException: Too many open files
Increase file descriptor limit under Linux to prevent java.net.SocketException: Too many open files
Increase file descriptor limit under Linux to

只有注册用户登录后才能发表评论。


网站导航:
 

<2024年12月>
24252627282930
1234567
891011121314
15161718192021
22232425262728
2930311234

常用链接

留言簿(6)

随笔档案

文章分类

文章档案

新闻分类

新闻档案

相册

收藏夹

搜索

  •  

最新评论

阅读排行榜

评论排行榜