Jetty 套接字文件描述符泄漏
Jetty socket file descriptor leak
Jetty version 9.4.20.v20190813
Java version 1.8.0_201
OS Ubuntu 18.04.3 LTS (Bionic Beaver)
堆栈跟踪:
2019-12-23T09:18:58,597 [qtp1702940637-19-acceptor-0@339ac900-ServerConnector@4f74980d{HTTP/1.1,[http/1.1]}{0.0.0.0:8090}] WARN AbstractConnector AbstractConnector.handleAcceptFailure(line:599).
java.io.IOException: Too many open files
at sun.nio.ch.ServerSocketChannelImpl.accept0(Native Method) ~[?:1.8.0_222]
at sun.nio.ch.ServerSocketChannelImpl.accept(ServerSocketChannelImpl.java:422) ~[?:1.8.0_222]
at sun.nio.ch.ServerSocketChannelImpl.accept(ServerSocketChannelImpl.java:250) ~[?:1.8.0_222]
at org.eclipse.jetty.server.ServerConnector.accept(ServerConnector.java:385) ~[jetty-server-9.4.20.v20190813.jar:9.4.20.v20190813]
at org.eclipse.jetty.server.AbstractConnector$Acceptor.run(AbstractConnector.java:664) [jetty-server-9.4.20.v20190813.jar:9.4.20.v20190813]
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:782) [jetty-util-9.4.20.v20190813.jar:9.4.20.v20190813]
at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:918) [jetty-util-9.4.20.v20190813.jar:9.4.20.v20190813]
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_222]
fd的数量在增加。 Netstat 显示 613 个打开的连接。 lsof 显示总共 4250 个文件。
java 5086 apb 3313u IPv4 15306277 0t0 TCP 10.184.14.44:8090->10.230.109.165:39706 (ESTABLISHED)
java 5086 apb 3314u sock 0,8 0t0 8799042 protocol: TCP
java 5086 apb 3315u IPv4 15298364 0t0 TCP 10.184.14.44:8090->10.230.48.95:47173 (ESTABLISHED)
java 5086 apb 3316u sock 0,8 0t0 10040260 protocol: TCP
java 5086 apb 3317u sock 0,8 0t0 9427901 protocol: TCP
java 5086 apb 3318u sock 0,8 0t0 8477043 protocol: TCP
java 5086 apb 3319u IPv4 15360584 0t0 TCP 10.184.14.44:8090->10.230.16.224:46865 (ESTABLISHED)
java 5086 apb 3320u sock 0,8 0t0 11300680 protocol: TCP
java 5086 apb 3321u sock 0,8 0t0 8479591 protocol: TCP
java 5086 apb 3322u sock 0,8 0t0 9162611 protocol: TCP
java 5086 apb 3323u sock 0,8 0t0 9581068 protocol: TCP
java 5086 apb 3324u sock 0,8 0t0 9887614 protocol: TCP
java 5086 apb 3325u sock 0,8 0t0 9162614 protocol: TCP
cat lsof.log | grep ESTABLISHED | wc -l
613
cat lsof.log | grep sock | wc -l
3332
像java 5086 apb 3320u sock 0,8 0t0 11300680 protocol: TCP
这样的行数正在增加。
服务器点入class:
@ServerEndpoint(
value = "/broad",
)
public class ServiceEndpoint {
...
@OnError
public void onError(Session session, Throwable t) {
session.close(new CloseReason(CloseReason.CloseCodes.CLOSED_ABNORMALLY, "Session Closed"));
}
}
是我做错了什么,还是Jetty有包?
其他人的回答:将 Jetty 版本更改为最新版本有帮助。
Jetty version 9.4.20.v20190813
Java version 1.8.0_201
OS Ubuntu 18.04.3 LTS (Bionic Beaver)
堆栈跟踪:
2019-12-23T09:18:58,597 [qtp1702940637-19-acceptor-0@339ac900-ServerConnector@4f74980d{HTTP/1.1,[http/1.1]}{0.0.0.0:8090}] WARN AbstractConnector AbstractConnector.handleAcceptFailure(line:599).
java.io.IOException: Too many open files
at sun.nio.ch.ServerSocketChannelImpl.accept0(Native Method) ~[?:1.8.0_222]
at sun.nio.ch.ServerSocketChannelImpl.accept(ServerSocketChannelImpl.java:422) ~[?:1.8.0_222]
at sun.nio.ch.ServerSocketChannelImpl.accept(ServerSocketChannelImpl.java:250) ~[?:1.8.0_222]
at org.eclipse.jetty.server.ServerConnector.accept(ServerConnector.java:385) ~[jetty-server-9.4.20.v20190813.jar:9.4.20.v20190813]
at org.eclipse.jetty.server.AbstractConnector$Acceptor.run(AbstractConnector.java:664) [jetty-server-9.4.20.v20190813.jar:9.4.20.v20190813]
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:782) [jetty-util-9.4.20.v20190813.jar:9.4.20.v20190813]
at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:918) [jetty-util-9.4.20.v20190813.jar:9.4.20.v20190813]
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_222]
fd的数量在增加。 Netstat 显示 613 个打开的连接。 lsof 显示总共 4250 个文件。
java 5086 apb 3313u IPv4 15306277 0t0 TCP 10.184.14.44:8090->10.230.109.165:39706 (ESTABLISHED)
java 5086 apb 3314u sock 0,8 0t0 8799042 protocol: TCP
java 5086 apb 3315u IPv4 15298364 0t0 TCP 10.184.14.44:8090->10.230.48.95:47173 (ESTABLISHED)
java 5086 apb 3316u sock 0,8 0t0 10040260 protocol: TCP
java 5086 apb 3317u sock 0,8 0t0 9427901 protocol: TCP
java 5086 apb 3318u sock 0,8 0t0 8477043 protocol: TCP
java 5086 apb 3319u IPv4 15360584 0t0 TCP 10.184.14.44:8090->10.230.16.224:46865 (ESTABLISHED)
java 5086 apb 3320u sock 0,8 0t0 11300680 protocol: TCP
java 5086 apb 3321u sock 0,8 0t0 8479591 protocol: TCP
java 5086 apb 3322u sock 0,8 0t0 9162611 protocol: TCP
java 5086 apb 3323u sock 0,8 0t0 9581068 protocol: TCP
java 5086 apb 3324u sock 0,8 0t0 9887614 protocol: TCP
java 5086 apb 3325u sock 0,8 0t0 9162614 protocol: TCP
cat lsof.log | grep ESTABLISHED | wc -l
613
cat lsof.log | grep sock | wc -l
3332
像java 5086 apb 3320u sock 0,8 0t0 11300680 protocol: TCP
这样的行数正在增加。
服务器点入class:
@ServerEndpoint(
value = "/broad",
)
public class ServiceEndpoint {
...
@OnError
public void onError(Session session, Throwable t) {
session.close(new CloseReason(CloseReason.CloseCodes.CLOSED_ABNORMALLY, "Session Closed"));
}
}
是我做错了什么,还是Jetty有包?
其他人的回答:将 Jetty 版本更改为最新版本有帮助。