JDK-6633385 : threw "Unrecognized Windows Socket error" while "Address already in use" expected
  • Type: Bug
  • Component: deploy
  • Sub-Component: deployment_toolkit
  • Affected Version: 6u10
  • Priority: P3
  • Status: Closed
  • Resolution: Cannot Reproduce
  • OS: windows
  • CPU: x86
  • Submitted: 2007-11-23
  • Updated: 2010-09-29
  • Resolved: 2008-02-27
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.
JDK 6
6u10Resolved
Description
Test run with:
java version "1.6.0_10-ea"
Java(TM) SE Runtime Environment (build 1.6.0_10-ea-b07)
Java HotSpot(TM) Client VM (build 1.6.0_10-ea-b07, mixed mode)

Steps to reproduce:
1. Install the kernel jre "*windows-i586-p-iftw-k.exe"
2. Make sure run the test from kerneljre's "initial form" 
   (either immediately(before Kernel has time to finish background downloading)run test after install, or perform step 3 4)
(optinal)3. Kill the background download ( by killing the "java" process )
(optinal)4. Remove all files under ${ProgramFiles}/Java/jre6/lib/bundles/
5. Run following test : java Test

Test should throw BindException, but it threw "java.net.SocketException: Unrecognized Windows Socket
s error: 0: Cannot bin", see the output "output for the first run"

6. Run again: java Test
   Test pass this time ( with all needed components alread downloaded/installed after first time run ), and threw expected BindException, see the output "output for the second run"

This test also "pass" with normal jdk/jre. But fail if run from "initial form" kernel jre. 

---- Test.java -----
import java.net.*;
import java.io.*;

public class Test {
    public static void main(String args[]) throws Exception {
        DatagramSocket s1 = new DatagramSocket(null);
        s1.bind( new InetSocketAddress(5889) );
        DatagramSocket s2 = new DatagramSocket(null);
        try {
            int port = s1.getLocalPort();
            System.out.println("Try to bind again on " + port );
            s2.bind( new InetSocketAddress(port) );
            System.out.println("Test failed.");
        } catch (BindException e) {
            System.out.println("Test passed. Got expected BindException");
            e.printStackTrace();
        } 
        s2.close();
        s1.close();
        }
}

---- output for the first run ----
Try to bind again on 5889
Exception in thread "main" java.net.SocketException: Unrecognized Windows Sockets error: 0: Cannot bind
        at java.net.PlainDatagramSocketImpl.bind0(Native Method)
        at java.net.PlainDatagramSocketImpl.bind(PlainDatagramSocketImpl.java:82)
        at java.net.DatagramSocket.bind(DatagramSocket.java:368)
        at Test.main(Test.java:25)

---- output for the second run ----
Try to bind again on 5889
Test passed. Got expected BindException
java.net.BindException: Address already in use: Cannot bind
        at java.net.PlainDatagramSocketImpl.bind0(Native Method)
        at java.net.PlainDatagramSocketImpl.bind(PlainDatagramSocketImpl.java:82)
        at java.net.DatagramSocket.bind(DatagramSocket.java:368)
        at Test.main(Test.java:25)

Comments
EVALUATION Seems to be working fine in the current build.
27-02-2008