Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 13 Feb 2002 10:10:53 -0500
From:      Dragos Ilie <dragos@niksun.com>
To:        FreeBSD Java <freebsd-java@FreeBSD.ORG>
Subject:   Socket bug
Message-ID:  <3C6A81FD.A45AB8C8@niksun.com>

next in thread | raw e-mail | index | archive | help
Apparently I've hit a socket bug using linux-jdk-1.3.1.01_1. I have a
client connecting to a web server. The web server streams data to the
client. The native method java.net.SocketInputStream.socketRead() throws
a SocketException: Resource temporarily unavailable instead of blocking
until data becomes available. This happens after we call read() for a
number of times (it varies).

After looking around on the web this is what I think happens. The native
code calls the C function recv(). If no data is available then errno
will be set to EAGAIN (resource unavailable). When the native code sees
that happen it panics and closes its side of the TCP connection by
sending a FIN (verified with tcpdump). Depending on your luck you'll
either get the SocketException or an IOException when you try to read
again from the socket. The interesting part is that the server keeps
open its end of the TCP connection and sends the remaining data. The
client is however unable to read it. I guess the socket is marked as
closed. Apparently this happens only on FreeBSD when using a jdk derived
from the Blackdown port.

A way to reproduce this problem is presented at the location below

http://www.geocrawler.com/archives/3/162/2000/4/0/3640547/


Did anybody experience this problem? Are there any known workarounds? We
tried the workaround shown in the URL above but it did not work for us.


Regards,
Dragos

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-java" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3C6A81FD.A45AB8C8>