Re: intermittent connection callback exceptions

Peter Jones <[email protected]> Wed, 1 Oct 2008 19:06:19 -0400
Newsgroups gmane.comp.java.sun.rmi
Message-ID <20081001230619.GA26719@east>
On Tue, Sep 30, 2008 at 04:28:53PM -0700, Mark Ackerman wrote:
> that seems to be the problem, we have a custom socket factory that
> you can limit the number of ports it can use (specified by an
> optional config file).

As this failure is happening on the client side of a remote invocation
attempt (even though it is on the "server" in the larger application
sense), I gather that this socket factory is limiting the source ports
used on the client side of connections?  If so, why is that necessary?

> Seems that all the ports are in use, (getting a
> "java.net.BindException: Address already in use").

And the socket factory's createSocket method is returning null in that
case?  Seems like it should throw that BindException instead.

> Well they're not really in use, they just don't seem to be getting
> released fast enough. Not sure why.

In the typical life cycle of a JRMP connection, it is the client side
that initiates the closing of the connection (i.e. the client side
sends the first FIN), so it is on the client side that the connection
remains in the TIME_WAIT state for a period, typically minutes, during
which the same client address & port cannot be used to connect to the
same server address & port.  Perhaps the rate of remote invocations to
this endpoint is low enough that JRMP connections are not getting
reused (the default idle connection timeout is 15 seconds), but high
enough that they are accumulating in the TIME_WAIT state-- exhausting
the limited source ports for the given destination address & port.

-- Peter

===========================================================================
To unsubscribe, send email to [email protected] and include in the body
of the message "signoff RMI-USERS".  For general help, send email to
[email protected] and include in the body of the message "help".

For a list of frequently asked RMI questions please refer to:
http://java.sun.com/j2se/1.3/docs/guide/rmi/faq.html

To view past RMI-USERS postings, please see:
http://archives.java.sun.com/archives/rmi-users.html