On Wed, 28 Oct 1998 20:28:52 +0000, Charles Forsythe wrote:
>Hello,
>
>Below is a some source code for a simple test. You invoke it with a
>hostname that has a telnet port (for historical reasons):
>
> java STest localhost
>
>Anyway, it spawns two threads.
>
>SThread opens a socket, unblocks a lock and then pends on a socket
>read().
>
>XThread waits on the lock, sleeps for a while and then closes the
>socket.
>
>What I expect to happen (and what happens on Linux JDK), is that when
>the socket is closed, the read() will throw an exception. What happens
>on HP is that the whole thing hangs. The close() hangs, the read()
>stays where it is.
>
>I think they have a bug involving blocking I/O (which was a problem with
>Linux JDK at one point). Is this really a bug, or is this acceptable
>behaviour. Someone please tell me it's a bug. They want to charge me
>$250/hr if they investigate it and it's not a bug.
Hmmm... This is a tough one.
You are closing a socket from another thread while the first thread
has already started to read from that socket. From an implementation
stand point, it could do almost anything. It should throw an exception
but that may depend on the soLinger setting. (Linger may prevent it
from pulling the socket closed on some IP stacks... I do not know the
HP stack and can not comment on it.)
The code to me looks rather nasty since it does depend on being able to
close a resource from another thread without there being some Monitor
(mutex in Java) on that resource to keep only one thread doing things
with it at once. I would personally feel that such code, while it may
work in some cases/systems, is not code I would assume would work
everywhere.
Michael Sinz -- Director of Research & Development, NextBus Inc.
mailto:[EMAIL PROTECTED] --------- http://www.nextbus.com
My place on the web ---> http://www.users.fast.net/~michael_sinz