On 17/04/2008, Kevan Miller <[EMAIL PROTECTED]> wrote: > > > On Apr 16, 2008, at 6:30 PM, Trygve Hardersen wrote: > > I checked out the 2.1.1 branch that is using openejb 3.0, but I'm > still getting the error. > > > Hi Trygve, > I'm guessing that you're running on a Windows? I've only seen this type of > error happen on a Windows. Note that this is a client socket (not a server > socket). We aren't assigning the port address... It's being assigned to the > socket dynamically. >
Yes, like I mentioned in the original post I'm testing on Windows XP SP2 (running in VMWare on Vista 64-bit) with Java 1.6. Production will be on Linux. One possibility is that you are exhausting the available user port numbers. > When a socket is closed, it goes into a TIME_WAIT state and isn't actual > closed until some delay time. By default, the max user port address is 5000 > and the TIME_WAIT delay is 4 minutes. So, it's not too difficult to exhaust > all possible user port addresses. > Sounds reasonable, and matches my understanding of the "Address already in use" error message. I am however able to reconnect in less than 4 minutes (like 100ms), so something must be released or made available quickly. But on the other hand errors are getting more frequent over time, which indicates a too-high timeout setting. You have to update the Windows Registry to change these values. Here's a > Windows 2000 doc on the registry settings -- > http://technet.microsoft.com/en-us/library/bb726981.aspx > > MaxUserPorts controls the upper range for user ports. > TcpTimedWaitDelay controls the TIME_WAIT delay. > > Hopefully, increasing MaxUserPorts (e.g. 65534) and decreasing > TcpTimedWaitDelay (e.g. 30)will fix your problem. > > If not, then I also recall a problem where Windows would assign the same > dynamic port address to 2 (or more) newly created sockets. It was then a > race to see which one would be activated first and the other one would get a > bind failure. Not sure there's anything we can do about that... > --kevan > > I'll do some tests on different platforms and settings and see what I find. Many thanks for your help! Trygve
