From owner-freebsd-java Sun Aug 19 20:55:14 2001 Delivered-To: freebsd-java@freebsd.org Received: from smtp02.mrf.mail.rcn.net (smtp02.mrf.mail.rcn.net [207.172.4.61]) by hub.freebsd.org (Postfix) with ESMTP id 2B5D737B419 for ; Sun, 19 Aug 2001 20:55:04 -0700 (PDT) (envelope-from archer@whichever.org) Received: from 207-172-163-52.s52.as5.xnb.nj.dialup.rcn.com ([207.172.163.52] helo=unknown.whichever.org) by smtp02.mrf.mail.rcn.net with esmtp (Exim 3.32 #2) id 15Yg9V-000538-00 ; Sun, 19 Aug 2001 23:55:02 -0400 Received: (from archer@localhost) by unknown.whichever.org (8.11.5/8.11.1) id f7K3sjd43713; Sun, 19 Aug 2001 23:54:45 -0400 (EDT) (envelope-from archer) Date: Sun, 19 Aug 2001 23:54:45 -0400 (EDT) Message-Id: <200108200354.f7K3sjd43713@unknown.whichever.org> From: Alexander Litvin To: Greg Lewis Cc: freebsd-java@freebsd.org Subject: Re: FreeBSD JDK1.2.2 Patchset 11??? In-Reply-To: <20010814043950.A7631@misty.eyesbeyond.com> X-Newsgroups: unknown.freebsd.java User-Agent: tin/1.5.8-20010221 ("Blue Water") (UNIX) (FreeBSD/5.0-CURRENT (i386)) 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 >> Any idea when a new jdk1.2.2 patchset will be available? > > I'm not sure. What bugfixes/functionality are you looking for? > > regards, Greg Ok, I'm not quite sure if this is relevant, because it is probably only about current, but here's description of the problem (I just don't know what is the politically correct fix for this): I started experiencing this problem at some time when I upgraded my CURRENT. Not exactly sure at what point did that happen (which means that I don't use java on freebsd extensively ;) This is with FreeBSD-CURRENT as of beginning of August, jdk-1.2.2b10 from ports, green threads, no jit. Anyway, the problem was that whenever I do some DNS stuff from java (like InetAddress.getByName()), interpreter dumps core. I could probably provide the stack trace, but unfortunately right now I have some custom libc as well as a bit modified libhpi.so and libjvm.so (modified as a part of investigation of the problem), and to revert it all to standard will take couple of days. But I have better then the stack trace -- I have the cause why it happens. Here's it: 1. InetAddress.getByName() eventually ends up calling gethostbyname_r(), which is implemented inside libhpi for green threads. 2. gethostbyname_r() calls gethostbyname(3) from libc, which in turn (simplified) calls res_ functions, which in turn end up calling syscalls (like socket(), connect(), sendto(), etc). 4. res_ functions call most of the syscalls directly (that is, like _socket(), _connect(), _sendto()). But there's one exclusion: res_send() calls send(). 5. And there's a reason: at some point send(2) syscall was eliminated from CURRENT. Rather, send() is implemented inside libc as _sendto(,,,,NULL,0). I'm not quite sure if the same can happen to STABLE. 6. When res_send() calls send(), it ends up not in the libc's implementation, but in libhpi's wrapper. Which is not ready at all (because other things like socket() and connect() were called from res_send() directly as syscalls, that is as _socket() and _connect()). Now, I'm not quite sure what was the initial intention: was it supposed that wrappers for syscalls from libhpi should be called from inside libc, or otherwise. Also, I'm not sure what is the correct solution. Somehow, libhpi is not ready for such changes in syscalls table. Changing send() to _sendto() inside res_send() allows at least simple program with InetAddress.getByName() to go through. -- #include To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-java" in the body of the message