geronimo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Craig Johannsen <>
Subject Re: Weird build errors on SuSE 9.2
Date Mon, 01 Nov 2004 03:54:25 GMT
Hi Aaron,

My environment is Mandrake Linux 9.1, kernel 2.4.2-0.13, libc-2.3.1, 651 
MHz Pentium III (Coppermine), and KDE shell. I tested your code with 
J2SDK 1.4.2_03-b02, mixed mode, and JDK 1.5.0-rc-b63, mixed mode, 
sharing. In each case the socket timeout didn't work using ssc.accept(). 
It would wait indefinately, just as the ServerSocketChannel.accept() API 
documentation says it will: " If this channel is in non-blocking mode 
then this method will immediately return null if there are no pending 
connections. Otherwise it will block indefinitely until a new connection 
is available or an I/O error occurs." The ServerSocket.accept() API 
documentation erroneously says: "Listens for a connection to be made to 
this socket and accepts it. The method blocks until a connection is 
made." However, at least it also says it may throw: 
- if a timeout was previously set with setSoTimeout and the timeout has 
been reached." So, the behaviour is mostly following the documentation, 
though I would like to see ServerSocketChannel.accept() pay attention to 
the timeout setting. I can't think of any reason it shouldn't. Probably 
it's a bug, but maybe a bug in the spec, assuming the API docs are correct.

Unfortunately, if you use ServerSocket instead of ServerSocketChannel, 
you lose all those nifty ByteBuffer operations. So, maybe it is a big 
change and much less efficient to use input and output streams rather 
than ByteBuffers.


Aaron Mulder wrote:

>On Sun, 31 Oct 2004, Aaron Mulder wrote:
>>	Right.  The question is, are we willing to change our code to 
>>accomodate a bug that, so far, only I am running into?  :)  I sent bug 
>>reports to Sun and SuSE, but I suspect they'll go to the great bit bucket 
>>in the sky, since SuSE 9.2 isn't a supported platform for Sun, and I doubt 
>>SuSE cares that much about JDK problems.
>>	Though, I guess I should ask, how were you able to duplicate the 
>>problem?  Do you also have a SuSE 9.2 machine, or did you do it on some 
>>other platform/kernel?
>>	Aaron
>>On Sun, 31 Oct 2004, Craig Johannsen wrote:
>>>Hi Aaron,
>>>"ssc.socket().accept()" throws a SocketTimeoutException, while 
>>>"ssc.accept()" does not. One would think that they would have identical 
>>>behaviour, but apparently not. Here's an example where the socket 
>>>timeout works with both JDK 1.4.2_03 and JDK 1.5.
>>>import java.nio.channels.*;
>>>// This code hangs on some Linux systems.
>>>public class Hang {
>>>public static void main(String[] args) {
>>>try {
>>>ServerSocketChannel ssc =;
>>>ssc.socket().bind(new InetSocketAddress(InetAddress.getLocalHost(), 
>>>} catch (IOException e) {

View raw message