Bug 14759 - ServerSocketChannel causes Selector.select() to return immediatly
Summary: ServerSocketChannel causes Selector.select() to return immediatly
Status: RESOLVED WONTFIX
Alias: None
Product: gcc
Classification: Unclassified
Component: libgcj (show other bugs)
Version: 3.3.4
: P2 minor
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-03-28 10:11 UTC by Debian GCC Maintainers
Modified: 2016-09-30 22:49 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2005-07-16 01:15:54


Attachments
example (570 bytes, text/plain)
2004-03-28 10:12 UTC, Debian GCC Maintainers
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Debian GCC Maintainers 2004-03-28 10:11:29 UTC
[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)
Comment 1 Debian GCC Maintainers 2004-03-28 10:12:07 UTC
Created attachment 6007 [details]
example
Comment 2 Sebastian Andersson 2004-03-30 05:59:11 UTC
Running the program with strace shows that two sockets are created (fd 5 and 6). The second socket (fd 6) is the one that is later given an address with bind(2), the first socket (fd 5) is the one that is used in the select(2) call.
Comment 3 Andrew Pinski 2004-04-04 06:21:59 UTC
Confirmed.
Comment 4 Michael Koch 2005-01-15 22:30:46 UTC
I'm working on it. 
Comment 5 Debian GCC Maintainers 2008-01-23 10:40:39 UTC
2005-01-15> I'm working on it.
Michael, any progress ;-?

  Matthias
Comment 6 Michael Koch 2008-01-23 10:43:25 UTC
Give back.
Comment 7 Andrew Pinski 2016-09-30 22:49:57 UTC
Closing as won't fix as libgcj (and the java front-end) has been removed from the trunk.