I've been trying to write unit tests for a simple udp listener service.
When I use a HotSpot jvm, the tests pass. When I use native threads,
the tests pass. When I use green threads, or a classic JVM, the tests
fail.
The tests are braindead simple. Open a udp listen socket, open a send
socket, send a packet, close the send socket, close the listen socket.
The point of the tests isn't to test the sockets, it's to test other
code's ability to decipher the received udp packet's payload properly.
The send socket is part of the text fixture, ultimately the listen
server is to be receiving packets from a remote device.
Anyway, the FIRST use of the listen socket always works. The subsequent
opens of the socket always FAIL, but only on green threads/classic JVMs.
I've studied everything I can find on the Bug Parade, and tried everything
they've listed as possible problems. I've tried adding sleeps()
after the listen socket close(), I've tried using a singleton, I can't
think of anything else to try.
I need this code to work on any JVM, I have to support linux, windows,
and solaris!
Sun 1.2.2 -classic : fails
Sun 1.2.2 : fails
Sun 1.3.0 -classic : fails
Sun 1.3.0 : success
Sun 1.3.1b15 -classic : fails
Sun 1.3.1b15 : success
Blackdown 1.3.0FCS -classic: success (!!)
Blackdown 1.3.0FCS : success
As far as I can tell, the JVM is leaving the socket open in the
kernel even though I've closed the socket, killed the thread,
and GC'd the objects!
I'm at my wits end. I've stepped through this with the debugger and
tossed printlns all through the app and the tests and I can see the
sockets being closed and both threads terminating. Still that damned
socket remains, blocking all subsequent use within the JVM.
If anyone can offer a suggestion, I'd really appreciate some pointers.
I've already studied Sun's Bug IDS 4137483, 4319693, 4400235, and
every other bugid those three cross-reference.
I've wasted two whole days on this now and I'm giving up.
--
Joi Ellis Software Engineer
Aravox Technologies [EMAIL PROTECTED], [EMAIL PROTECTED]
No matter what we think of Linux versus FreeBSD, etc., the one thing I
really like about Linux is that it has Microsoft worried. Anything
that kicks a monopoly in the pants has got to be good for something.
- Chris Johnson
----------------------------------------------------------------------
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]