This discussion is archived
3 Replies Latest reply: Mar 22, 2013 2:40 PM by 997336 RSS

Supernumerary JMX RMI thread? There should be two. There are three.

881080 Newbie
Currently Being Moderated
Hi,

I'm using JMX on 1.6.0_26-b03 on Linux Red Hat 6.1

When I configure JMX over RMI for remote access, the JVM allocates three TCP ports:

<li> One TCP port for the RMI registry at a fixed address (here, 7997)
<li> An ephemeral (randomly chosen) TCP port for JMX RMI and
<li> A second ephemeral TCP port

I have no idea what this second TCP port does and I don't think it should be there. When I configure JMX for local access, the first two port allocations are gone, but the third one is still there.

Inspection using VisualVM reveals the names of the TCP port listening threads to be:

<li> <tt>RMI TCP-Accept-7997</tt>
<li> <tt>RMI TCP-Accept-0</tt>
<li> <tt>RMI TCP-Accept-0</tt>

The thread dumps reveal that the expected JMX-RMI listening thread is called through <tt>sun.management.jmxremote.LocalRMIServerSocketFactory$1.accept()</tt>
"RMI TCP Accept-0" - Thread t@12
   java.lang.Thread.State: RUNNABLE
     at java.net.PlainSocketImpl.socketAccept(Native Method)
     at java.net.PlainSocketImpl.accept(PlainSocketImpl.java:408)
     - locked <388a2006> (a java.net.SocksSocketImpl)
     at java.net.ServerSocket.implAccept(ServerSocket.java:462)
     at java.net.ServerSocket.accept(ServerSocket.java:430)
     at sun.management.jmxremote.LocalRMIServerSocketFactory$1.accept(LocalRMIServerSocketFactory.java:34)
     at sun.rmi.transport.tcp.TCPTransport$AcceptLoop.executeAcceptLoop(TCPTransport.java:369)
     at sun.rmi.transport.tcp.TCPTransport$AcceptLoop.run(TCPTransport.java:341)
     at java.lang.Thread.run(Thread.java:662)
...whereas the unexpected one is not called that way:
"RMI TCP Accept-0" - Thread t@10
   java.lang.Thread.State: RUNNABLE
     at java.net.PlainSocketImpl.socketAccept(Native Method)
     at java.net.PlainSocketImpl.accept(PlainSocketImpl.java:408)
     - locked <31bd669d> (a java.net.SocksSocketImpl)
     at java.net.ServerSocket.implAccept(ServerSocket.java:462)
     at java.net.ServerSocket.accept(ServerSocket.java:430)
     at sun.rmi.transport.tcp.TCPTransport$AcceptLoop.executeAcceptLoop(TCPTransport.java:369)
     at sun.rmi.transport.tcp.TCPTransport$AcceptLoop.run(TCPTransport.java:341)
     at java.lang.Thread.run(Thread.java:662)
So - is this a bug or else, what's that third TCP port for exactly?

-- David

Edited by: user13544767 on Aug 8, 2011 2:05 PM

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points