bug-classpath
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug classpath/35520] New: Server socket port kept bound even after the


From: kaz at maczuka dot gcd dot org
Subject: [Bug classpath/35520] New: Server socket port kept bound even after the VM ends
Date: 10 Mar 2008 01:19:39 -0000

The port used by java.net.ServerSocket is kept bound even afrer
the VM ends.

Here is a testcase.

$ cat TestAccept.java 
import java.net.*;
public class TestAccept {
  public static void main(String args[]) throws Exception {
    ServerSocket server=new ServerSocket(Integer.parseInt(args[0]));
    Socket clientSocket = server.accept();
    clientSocket.close();
    server.close();
  }
}
$ java TestAccept 9999 &
[1] 11213
$ nc localhost 9999
[1]+  Done                    java TestAccept 9999
$ java TestAccept 9999 &
[1] 11218
$ java.net.BindException: Address already in use
   at java.lang.VMThrowable.fillInStackTrace (VMThrowable.java:native)
   at java.lang.VMThrowable.fillInStackTrace (VMThrowable.java:79)
   at java.lang.Throwable.fillInStackTrace (Throwable.java:498)
   at java.lang.Throwable.<init> (Throwable.java:159)
   at java.lang.Exception.<init> (Exception.java:78)
   at java.io.IOException.<init> (IOException.java:72)
   at java.net.SocketException.<init> (SocketException.java:73)
   at java.net.BindException.<init> (BindException.java:72)
   at gnu.java.net.VMPlainSocketImpl.bind (VMPlainSocketImpl.java:native)
   at gnu.java.net.VMPlainSocketImpl.bind (VMPlainSocketImpl.java:302)
   at gnu.java.net.PlainSocketImpl.bind (PlainSocketImpl.java:306)
   at java.net.ServerSocket.bind (ServerSocket.java:250)
   at java.net.ServerSocket.<init> (ServerSocket.java:181)
   at java.net.ServerSocket.<init> (ServerSocket.java:155)
   at java.net.ServerSocket.<init> (ServerSocket.java:137)
   at TestAccept.main (TestAccept.java:4)

[1]+  Exit 1                  java TestAccept 9999


-- 
           Summary: Server socket port kept bound even after the VM ends
           Product: classpath
           Version: 0.97
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: classpath
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: kaz at maczuka dot gcd dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35520





reply via email to

[Prev in Thread] Current Thread [Next in Thread]