Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 7 Feb 2003 22:39:02 -0500
From:      Brent Verner <brent@rcfile.org>
To:        freebsd-java@FreeBSD.ORG
Cc:        William Holt <wiholt@cabrillo.edu>
Subject:   Re: problem and workaround for java/tomcat on -current
Message-ID:  <20030208033902.GA5841@rcfile.org>
In-Reply-To: <20030203105027.GA86700@rcfile.org>
References:  <20030203105027.GA86700@rcfile.org>

next in thread | previous in thread | raw e-mail | index | archive | help
  To follow up on this, it appears (if I can trust gdb w/java), 
that Java_java_net_InetAddressImpl_getHostByAddr calls the 
gethostbyaddr_r in libc.so.5 instead of the one provided in
native/java/net/InetAddressImpl.c, leaving hp == -1, which 
gives us the bus error -> abort.

the system gethostbyaddr_r has a prototype of
  int gethostbyaddr_r(const char *, int len, int type,
                      struct hostent *, struct hostent_data *)

I've simply renamed the gethostby...._r to l_gethostby...._r, and am 
rebuilding now to verify this theory.  I'll let yall know what the 
outcome is.

Q: why would the locally provided gethostby...._r be named to 
   conflict with a libc function?

Q: what is the _right_ way to solve this if gdb showed me the truth,
   and the problem was an libc conflict?  I'd think it would be
   best to continue to use the local gethostby...._r functions
   (especially considering that the ones in libc specifically 
    note non-reentrancy).

btw, is there a "correct" way to run the jvm under gdb?  I ended
up having to "jump" over a read() call that was hanging...

thanks.
  b

[2003-02-03 05:50] Brent Verner said:
| Sometime after Jan 20, -current has been unable to run tomcat
| (and other things, such as the Jetty issue William Holt reported).
| I took his CrashBSD.java prog, and further determined that only
| the "0.0.0.0" caused the bus error -> abort problem.
| 
| import java.net.*;
| public class CrashBSD
| {
|     static public void main( String args[] )
|     {
|         try
|         {
|             InetAddress a = InetAddress.getByName("127.0.0.1");
|             ServerSocket sa = new ServerSocket(0,10,a);
|             System.out.println(sa);
|             InetAddress b = InetAddress.getByName("0.0.0.0");
|             ServerSocket sb = new ServerSocket(0,10,b);
|             System.out.println(sb);
|         } 
|         catch ( Exception e ) 
|        { 
|            System.out.println( e );
|            System.exit( 1 ); 
|        }
|    }
| }
| 
| You'll notice that the 127.0.0.1 InetAddress works just fine, but
| the "0.0.0.0" addr causes the error.  I dug a bit further into
| what change since 20 Jan is causing this, but had no luck.  However,
| the problem can be worked around by adding a line in the /etc/hosts
| for the "0" ip.
| 
| 0.0.0.0                 all.interfaces.on.this.machine
| 
| What strange effects might this cause?  I have no clue :-), but 
| tomcat seems to be happy again...
| 
| hth,
|   brent
| 
| 
| To Unsubscribe: send mail to majordomo@FreeBSD.org
| with "unsubscribe freebsd-java" in the body of the message

-- 
"Develop your talent, man, and leave the world something. Records are 
really gifts from people. To think that an artist would love you enough
to share his music with anyone is a beautiful thing."  -- Duane Allman

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?20030208033902.GA5841>