Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 19 Aug 2001 23:54:45 -0400 (EDT)
From:      Alexander Litvin <archer@whichever.org>
To:        Greg Lewis <glewis@eyesbeyond.com>
Cc:        freebsd-java@freebsd.org
Subject:   Re: FreeBSD JDK1.2.2 Patchset 11???
Message-ID:  <200108200354.f7K3sjd43713@unknown.whichever.org>
In-Reply-To: <20010814043950.A7631@misty.eyesbeyond.com>

next in thread | previous in thread | raw e-mail | index | archive | help
>> 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 <signature.h>


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?200108200354.f7K3sjd43713>