[英]java.net.BindException: Cannot assign requested address when opening too many connections
[英]java.net.BindException: Cannot assign requested address, java.io.IOException: Too many open files
我收到异常java.net.BindException:无法分配请求的地址,如果发生此异常,我尝试再次使用相同的端口和主机绑定它。 但是在尝试绑定之后我得到java.io.IOException:打开的文件太多了。
堆栈跟踪:
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).
一些失败后:
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)
当java.net.BindException:无法分配请求的地址时,FD是否可能保持打开状态?
这通常是操作系统级别的问题。 查看可以打开的文件数量。 在linux上,设置在/etc/security/limits.conf中:
UID soft nofile 4096 UID hard nofile 10240
当java.net.BindException:无法分配请求的添加时,FD是否可能保持打开状态?
是。 你必须自己关闭插座。 显然你有套接字泄漏。
我没有看到重试绑定的重点。 它仍然会失败。 可能原始绑定问题也是由于套接字泄漏造成的。
也许ip问题到了/ etc / hosts并将其更改为
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.