dev@glassfish.java.net

Re: mysterious ports

From: Joseph Fialli <joe.fialli_at_oracle.com>
Date: Fri, 10 Sep 2010 11:17:32 -0400

On 9/10/10 10:53 AM, Tom Mueller wrote:
> I've been looking at the ports that cluster members listen on, and I'm
> seeing some mysterious ports. Can someone please identify what these
> ports are being used for? Also, how are the port numbers allocated?
>
> Here are the ports used by a typical instance, running without GMS
> enabled and with JMS in embedded mode:
>
> TCP *:28081 (LISTEN) < HTTP_LISTENER_PORT
> TCP *:28182 (LISTEN) < HTTP_SSL_LISTENER_PORT
> TCP *:24849 (LISTEN) < ASADMIN_LISTENER_PORT
> TCP 127.0.0.1:26667 (LISTEN) < OSGI_SHELL_TELNET_PORT
> TCP *:27677 (LISTEN) < JMS_PROVIDER_PORT
> TCP *:27777 (LISTEN) < ?????
> TCP *:16426 (LISTEN) < ?????
> TCP *:52978 (LISTEN) < ?????
> TCP *:32874 (LISTEN) < ?????
> TCP *:4910 (LISTEN) < ?????
> TCP *:28687 (LISTEN) < JMX_SYSTEM_CONNECTOR_PORT
>
> The concern that I have with these ports is that they appear to be
> dynamically allocated, because they change each time the instance is
> run and for different instances, but except for one, they are
> allocated from the outside the region for allocating dynamic ports
> (which is 49152 to 65535). And if the port number chosen happens to be
> the one that another instance on the same system is going to use, then
> that instance will fail to start because it can't bind to it's port.
>
> I also curious as to what determines the address that these sockets
> are bound too, for the multihomed server use case.
Figured I would provide info on GMS on this.


For multihome case, it is OS specific and non-deterministic which
address that GMS uses. We get the list of network interfaces
using java.net.NetworkInterface.getNetworkInterfaces(). This list is
not sorted and thus non-deterministic from OS to OS.
We select the first one in the list that meets our usage criteria:
not lookback and supports multicast. Then we select the first address
based on whether the preference is ipv4 or ipv6 address.
The code for this is in
com.sun.enterprise.mgmt.transport.NetworkUtility.java. It is part of
shoal-gms-impl.java.

GMS has a cluster element gms-bind-interface-address attribute so the
user can specify which network interface on a multihome machine
the user would prefer GMS to use. This funtionality was added in
Glassfish v2.1 so GMS could be assigned to a private network interface
so its multicast broadcast would stay internal only.

-Joe

>
> Thanks.
> Tom
>
>
>