[英]java.net.BindException: Cannot assign requested address, java.io.IOException: Too many open files
I am getting exception java.net.BindException: Cannot assign requested address, and if this exception occurred I try to bind it again with the same port and host. 我收到异常java.net.BindException:无法分配请求的地址,如果发生此异常,我尝试再次使用相同的端口和主机绑定它。 But after some attempt of bind I am getting java.io.IOException: Too many open files.
但是在尝试绑定之后我得到java.io.IOException:打开的文件太多了。
Stack Trace: 堆栈跟踪:
java.net.BindException: Cannot assign requested address
at sun.nio.ch.Net.bind0(Native Method)
at sun.nio.ch.Net.bind(Net.java:444)
at sun.nio.ch.Net.bind(Net.java:436)
at sun.nio.ch.SctpServerChannelImpl.bind(SctpServerChannelImpl.java:109)
at com.sun.nio.sctp.SctpServerChannel.bind(SctpServerChannel.java:184).
and after some failure: 一些失败后:
java.io.IOException: Too many open files
at sun.nio.ch.IOUtil.makePipe(Native Method)
at sun.nio.ch.EPollSelectorImpl.<init>(EPollSelectorImpl.java:65)
at sun.nio.ch.EPollSelectorProvider.openSelector(EPollSelectorProvider.java:36)
at java.nio.channels.Selector.open(Selector.java:227)
Is it possible that FD remains open when java.net.BindException: Cannot assign requested address ? 当java.net.BindException:无法分配请求的地址时,FD是否可能保持打开状态?
This is usually an OS level issue. 这通常是操作系统级别的问题。 Look into bumping up the number of files that can be open.
查看可以打开的文件数量。 On linux the setting is in /etc/security/limits.conf:
在linux上,设置在/etc/security/limits.conf中:
UID soft nofile 4096 UID hard nofile 10240 UID soft nofile 4096 UID hard nofile 10240
Is it possible that FD remains open when java.net.BindException: Cannot assign requested add?
当java.net.BindException:无法分配请求的添加时,FD是否可能保持打开状态?
Yes. 是。 You have to close the socket yourself.
你必须自己关闭插座。 Clearly you have a socket leak.
显然你有套接字泄漏。
I don't see the point of retrying the bind. 我没有看到重试绑定的重点。 It will still fail.
它仍然会失败。 Probably the original bind problem is also due to a socket leak.
可能原始绑定问题也是由于套接字泄漏造成的。
也许ip问题到了/ etc / hosts并将其更改为
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.