1

I have been debugging an issue with a java process opening a random port in the range of 30,000 to 50,000.

I was interested to see what is the thread stack associated with the socket that had the port, so I gathered a heap dump of the java process and determined that the stack thread has the name "RMI TCP Accept-0". With a little bit of Googling I found that this thread could be used for JMX monitoring by jConsole

So I was looking for a way to control this port number and I found a related answer here

Even after specifying the port number, I can still see that the Java process is opening this random port

I would like to revisit the stack and see if my understand that it could be a JMX port is correct. Here is the stack I see:

"RMI TCP Accept-0" daemon prio=10 tid=0x00007f3367404000 nid=0x14fb runnable [0x00007f33507b3000]
   java.lang.Thread.State: RUNNABLE
        at java.net.PlainSocketImpl.socketAccept(Native Method)
        at java.net.AbstractPlainSocketImpl.accept(AbstractPlainSocketImpl.java:398)
        at java.net.ServerSocket.implAccept(ServerSocket.java:530)
        at java.net.ServerSocket.accept(ServerSocket.java:498)
        at sun.rmi.transport.tcp.TCPTransport$AcceptLoop.executeAcceptLoop(TCPTransport.java:388)
        at sun.rmi.transport.tcp.TCPTransport$AcceptLoop.run(TCPTransport.java:360)
        at java.lang.Thread.run(Thread.java:745)

   Locked ownable synchronizers:
        - None
Community
  • 1
  • 1
  • Just to clarify, you're certain that this process is *listening* on this random port? What OS is this? – Alex Jan 23 '15 at 21:28
  • Check this answer: http://stackoverflow.com/questions/20884353/why-java-opens-3-ports-when-jmx-is-configured – Alex Jan 23 '15 at 21:33
  • Yes I forgot to mention that. It is in Listening state on that port. I am checking the thread will post in a moment what gives. – vinay chilakamarri Jan 23 '15 at 21:43

0 Answers0