You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@geronimo.apache.org by John Sisson <jr...@gmail.com> on 2006/10/01 13:50:17 UTC

Re: Failure when looking up an EJB consecutively

Arunanthisivam Vimalathithen wrote:
> Hi,
>  
> I am having a problem in an application I am trying to port to 
> WebSphere community edition which basically uses Geronimo 1.0 (This 
> problem exists in the latest version of Geronimo (1.1.1) as well). The 
> client I am using looks up the service numerous times consecutively 
> and invokes the services. The problem happens when this has gone past 
> more than 630 times, the client simply fails to look up and produces 
> the following error:
>  
> _java.rmi.RemoteException_: Cannot access server: /127.0.0.1:_4201_ 
> Exception: ; nested exception is: _ java.io.IOException_: Cannot 
> access server: /127.0.0.1:4201 _Exception_: _java.net.BindException_ : 
> Address already in use: connect
>  
> The same error can be produced by looking up and invoking a simple 
> hello world EJB in a loop of 700 times. This happens in the latest 
> release of Geronimo (sometimes the loop might need to be increased to 
> 1000). Any work arounds to this?
>  
> Thanks and regards,
>  
> Vimalan

If you are on Windows you can encounter problems if a large number of 
socket connections within a short period of time, causing Windows to 
exhaust its pool of ephemeral ports (default is port range 1024-5000). 
When each of these connections is closed, they will remain in TIME_WAIT 
for a period of time (default of 240 seconds) before the ephemeral port 
is available. Windows will not reuse a port until it has exhausted its 
pool of ephemeral ports. If this problem occurs, you need to set the 
[MaxUserPort] to a larger value and reduce the [TcpTimedWaitDelay] in 
the registry settings. See the following for further details: 
http://support.microsoft.com/kb/196271/EN-US/ and
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/randz/protocol/tcp_time-wait_delay.asp

Each InitialContext you create will cause a TCP connection to be started 
to OpenEJB.  See some notes about the processing going on whilst 
creating an InitialContext in 
http://issues.apache.org/jira/browse/GERONIMO-1085 .
AFAIK, each remote call will also start a connection.  AFAIK, some other 
app servers may leave connections open for a period of time and re-use 
them, therefore reducing the chance of hitting this problem of 
exhausting the pool in windows.

Regards,

John