From owner-freebsd-java Wed Feb 13 7:11:44 2002 Delivered-To: freebsd-java@freebsd.org Received: from arjun.niksun.com (gwnew.niksun.com [63.148.27.34]) by hub.freebsd.org (Postfix) with ESMTP id 3610B37B4C6 for ; Wed, 13 Feb 2002 07:10:50 -0800 (PST) Received: from niksun.com (arjun.niksun.com [10.0.0.5]) by arjun.niksun.com (8.9.3/8.9.3) with ESMTP id KAA63777 for ; Wed, 13 Feb 2002 10:10:49 -0500 (EST) (envelope-from dragos@niksun.com) Message-ID: <3C6A81FD.A45AB8C8@niksun.com> Date: Wed, 13 Feb 2002 10:10:53 -0500 From: Dragos Ilie Organization: NIKSUN, Inc. http://www.niksun.com X-Mailer: Mozilla 4.76 [en] (X11; U; FreeBSD 4.2-RELEASE i386) X-Accept-Language: en MIME-Version: 1.0 To: FreeBSD Java Subject: Socket bug Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-java@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org 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