java openfile busy,java程序中的文件描述符泄漏:打开的文件太多

I have a program which suffer from file descriptor increasing.

I see when I execute the command ls -l /proc/5969/fd where 5969 is the pid of the java program the number of file descriptor continuously increasing.

but I am unable to open one of those files decriptors to see what file remains open :

here is an example of the listing :

lrwx------ 1 root root 64 oct 24 16:08 52295 -> socket:[2577706264]

lrwx------ 1 root root 64 oct 24 16:08 52296 -> socket:[2579543392]

lrwx------ 1 root root 64 oct 24 16:08 52297 -> socket:[2578760962]

Please help me finding a way to solve this file descriptor leak in knowing what files remains open and increase the file descriptor number.

解决方案

Well, from a quick observation, you are using file descriptors on sockets, not files

In UNIX, both files and sockets use file descriptors, and so you have a problem where you are not closing sockets that you open.

As a result, you are not leaving a file open but are actually leaving port numbers locked from use by other programs.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值