[Bug libgcj/14759] New: ServerSocketChannel causes Selector.select() to return immediatly

debian-gcc at lists dot debian dot org gcc-bugzilla@gcc.gnu.org
Sun Mar 28 10:11:00 GMT 2004


[forwarded from http://bugs.debian.org/240550]

If a ServerSocketChannel has been registered for SelectionKey.OP_ACCEPT 
at a Selector, select() will return immediatly with OP_ACCEPT on that 
Channel, even when there is no connection waiting. 
 
See example attached.


Compile and run it with: 
gcj-3.3 --main=Server Server.java && ./a.out 
 
and it will output: 
Before selector 
Something was selected. 
Before accept. 
 
and hang in the ServerSocket.accept() method until a connection 
happens. 

Using gcj-3.4 (20040314):

Before selector  [waiting]
Something was selected.
Before accept.
java.nio.channels.IllegalBlockingModeException
   at java.net.ServerSocket.implAccept(java.net.Socket)
(/usr/lib/gcc-snapshot/lib/libgcj.so.5.0.0)
   at gnu.java.nio.NIOServerSocket.accept()
(/usr/lib/gcc-snapshot/lib/libgcj.so.5.0.0)
   at Server.main(java.lang.String[]) (Unknown Source)

-- 
           Summary: ServerSocketChannel causes Selector.select() to return
                    immediatly
           Product: gcc
           Version: 3.3.4
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: libgcj
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: debian-gcc at lists dot debian dot org
                CC: gcc-bugs at gcc dot gnu dot org,java-prs at gcc dot gnu
                    dot org


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



More information about the Java-prs mailing list