United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
JDK-4476378 : SO_REUSEADDR broken on Windows

Details
Type:
Bug
Submit Date:
2001-06-29
Status:
Resolved
Updated Date:
2001-08-02
Project Name:
JDK
Resolved Date:
2001-08-02
Component:
core-libs
OS:
generic,windows_95,windows_2000
Sub-Component:
java.net
CPU:
generic,x86
Priority:
P2
Resolution:
Fixed
Affected Versions:
1.4.0
Fixed Versions:
1.4.0 (beta2)

Related Reports
Duplicate:
Duplicate:
Duplicate:

Sub Tasks

Description
Currently we only enable SO_REUSEADDR on Windows in very limited
circumstances. This stems from the fact that SO_REUSEADDR does not
implement BSD semantics on Windows. Specifically :-

1. SO_REUSEADDR on TCP sockets allows multiple processes to bind
to the same port/address. This is incorrect semantics as it should
only be possible to bind to the same port on a more specific
address - see 4446078 for details.

2. For TCP sockets the SO_REUSEADDR option allows multiple processes
to accept connections on the same port. Simililarly multiple processes
can receive non-multicast packets whereas the right semantics is
that SO_REUSEADDR on UDP sockets should only allow the second and
subsequent processes to receive multicast packets. For TCP sockets
there is SO_EXCLSUIVEADDRUSE socket option but its use is limited
and isn't appropriate for multicast sockets.

For merlin-beta we have a short term solution in place to avoid
the above 2 issues. The short term solution is to only allow 
SO_REUSEADDR to be enabled in limited circumstances. Specifically :-

1. {Socket,ServerSocket,DatagramSocket}.setReuseAddress(true) doesn't 
enable SO_REUSEADDR on Windows unless there is registry settings
indicating that it's secure. 

2. For MulticastSocket we will allow SO_REUSEADDR to be enabled
if the application is binding to the wildcard address. If 
binding to a specific address we disable SO_REUSEADDR. 

alan.bateman@ireland 2001-06-29

                                    

Comments
CONVERTED DATA

BugTraq+ Release Management Values

COMMIT TO FIX:
merlin-beta2

FIXED IN:
merlin-beta2

INTEGRATED IN:
merlin-beta2


                                     
2004-06-14
EVALUATION


Needs to be fixed by beta-refresh.
alan.bateman@ireland 2001-06-29

Name: dfR10049			Date: 06/29/2001

Commit to fix in merlin-ea

======================================================================

Name: dfR10049			Date: 06/29/2001

Please ignore my previous evaluation. I used different bugID.

======================================================================


SO_REUSEADDR socket option has now been clean-up in terms of
implementation and specification. Specifically :-

1. setReuseAddress(true) now enables the SO_REUSEADDR socket option
on all platforms. 

2. MulticastSocket constructors will enable SO_REUSEADDR by default.

3. ServerSocket specification no longer specifies that the socket
option is enabled by default. In implementation terms it will be
enabled on Solaris/Linux and on Windows it won't be enabled. This
resolves backward compatibility issues and there isn't any issues
related to restarting a server if a previous connection is in
TIME_WAIT state.

alan.bateman@ireland 2001-08-02
                                     
2001-08-02



Hardware and Software, Engineered to Work Together