JDK-6286189 : Address already in use BindException throws with IPv6 Socket
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.net
  • Affected Version: 5.0,5.0u3
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: windows_2003,windows_xp
  • CPU: x86
  • Submitted: 2005-06-15
  • Updated: 2010-04-26
  • Resolved: 2005-07-13
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other JDK 6
5.0u6Fixed 6 betaFixed
Description
J2SE Version (please include all output from java -version flag):
  Java 1.5.0_03

Does this problem occur on J2SE 1.4.x or 5.0.x ?  Yes / No (pick one)
  Works fine with 1.4 and IPv4

Operating System Configuration Information (be specific):
  Windows 2003 without a SP
  Mail Server is Exchange 5.5 with IPv4

Bug Description:
  Each connect to an IMAP-Account opens a new ServerSocket.
  After some time there are no free socket ports and get an exeptions like:
 
  javax.mail.MessagingException: Address already in use: JVM_Bind;
    nested exception is: 
  java.net.BindException: Address already in use: JVM_Bind
   at com.sun.mail.imap.IMAPStore.protocolConnect(IMAPStore.java:441)
   at javax.mail.Service.connect(Service.java:233)
   at javax.mail.Service.connect(Service.java:134)
 
Steps to Reproduce (be specific):

 run attached IMAP_Socket_Test program 2-3 minutes
  until the exceptions occur. 
 
  In this time you can see with "netstat -na" on an other console the
  increasing number of ServerSockets.
 
  To run the test "IMAP_Socket_Test" you need to edit the file IMAP_Socket_Test.bat.   You need to fill in the host, accont and password of an existing IMAP-Account.






###@###.### 2005-06-15 19:08:29 GMT

Comments
WORK AROUND If IPv6 is not required then by running with -Djava.net.preferIPv4Stack=true will work-around the problem ###@###.### 2005-07-05 09:29:34 GMT
05-07-2005

EVALUATION We seem to be leaking IPv6 socket descriptors. The IPv6 socket is not being closed, when we connect to an IPv4 destination, so the system eventually runs out of sockets. We will fix for mustang (initially). ###@###.### 2005-07-05 09:29:34 GMT ###@###.### 2005-07-05 10:35:15 GMT The problem is actually with client Sockets rather than ServerSockets as originally suggested in the description. Also affects Windows XP. ###@###.### 2005-07-05 11:14:28 GMT
05-07-2005