简体   繁体   English

确定在Java中为套接字进入CLOSE_WAIT状态创建代码的套接字

[英]Identify code creating socket in java for socket going to CLOSE_WAIT state

I am getting lot of CLOSE_WAIT sockets and not able to determine which file/ line is responsible for the socket in CLOSE_WAIT state. 我收到了许多CLOSE_WAIT套接字,无法确定哪个文件/行负责CLOSE_WAIT状态的套接字。 I am able to determine the port number which is going to CLOSE_WAIT and the process associated with the port number using lsof -Pni : | 我可以使用lsof -Pni确定将要进入CLOSE_WAIT的端口号以及与该端口号关联的过程: more and ss commands. 更多和ss命令。 But Unable to figure out the java class where the port is created. 但是无法找出创建端口的java类。 Is there a way to identify the java class which is responsible for creating the socket which is going to close wait state. 有没有一种方法可以识别负责创建要关闭等待状态的套接字的java类。

Thanks... 谢谢...

You can start your application in debug mode and if the program have CLOSE_WAIT states than try to pause your program and look into the stacktrace. 您可以在调试模式下启动应用程序,并且如果程序具有CLOSE_WAIT状态,则可以尝试暂停程序并查看堆栈跟踪。 Or: Perhaps you can use VisualVM to analyse with classes , objects and threads are in the JVM. 或者:也许您可以使用VisualVM来分析JVM中的类,对象和线程。 https://visualvm.java.net/ https://visualvm.java.net/

But I think there is no direct way to see witch port is bind to witch class. 但是我认为没有直接的方法可以看到女巫端口绑定到女巫类。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM