jdk-1.6.0 libz linking problem

G. Paul Ziemba pz-freebsd-java at ziemba.us
Mon Mar 28 07:55:03 UTC 2011


[Summary: I think my build of java calls system libz, which calls
java port's inflate_fast() with incompatible arguments]

Hi,

I'm having some difficulties with jdk-1.6.0.3p4_20 (although I think I
am also seeing the problem in diablo-jdk-1.6.0.07.02_12). I'm not
experienced with java so I hope one of the resident experts could comment.
(Compared to me, probably anyone here qualifies as an expert!)

FreeBSD 8.2-PRERELEASE #1: Sun Jan 23 00:28:46 PST 2011
jdk: jdk-1.6.0.3p4_20

I am running the application "yajhfc" which is provided in a jar
file at ftp://ftp.berlios.de/pub/yajhfc/temp/beta/yajhfc-0_5_0rc6.jar.
There is ongoing development so the revision number changes often;
directory visible at ftp://ftp.berlios.de/pub/yajhfc/temp/beta/

At startup, java segfaulted in inflate_fast(). I rebuilt the jdk with
debugging enabled and ran as follows:

% (setenv JAVA_HOME /usr/local/jdk1.6.0/debug; java -jar yajhfc-0_5_0rc6.jar)

This produced hs_err_pid18257.log and java.core, and I ran gdb as:

% gdb /usr/local/jdk1.6.0/debug/bin/java java.core

(gdb) where
#0  0x2810466b in thr_kill () from /lib/libc.so.7
#1  0x280b3916 in pthread_kill () from /lib/libthr.so.3
#2  0x280b1393 in raise () from /lib/libthr.so.3
#3  0x281a76ca in abort () from /lib/libc.so.7
#4  0x28877ff8 in os::abort (dump_core=679985409)
    at /v2/ports/java/jdk16/work/hotspot/src/os/bsd/vm/os_bsd.cpp:1596
#5  0x289d0227 in VMError::report_and_die (this=0xbf8fcc14)
    at /v2/ports/java/jdk16/work/hotspot/src/share/vm/utilities/vmError.cpp:807
#6  0x2887a97c in JVM_handle_bsd_signal (sig=11, info=0xbf8fcfb0, 
    ucVoid=0xbf8fccf0, abort_if_unrecognized=1)
    at /v2/ports/java/jdk16/work/hotspot/src/os_cpu/bsd_i486/vm/os_bsd_i486.cpp:522
#7  0x288758e2 in signalHandler (sig=11, info=0xbf8fcfb0, uc=0xbf8fccf0)
    at /v2/ports/java/jdk16/work/hotspot/src/os/bsd/vm/os_bsd.cpp:3335
#8  <signal handler called>
#9  0x29131f59 in inflate_fast (bl=1544798720, bd=2540, tl=0x17, 
    td=0x5c14c06c, s=0x5c14c058, z=0x5c14c2f0)
    at ../../../src/share/native/java/util/zip/zlib-1.1.3/inffast.c:53
#10 0x293f115c in inflate () from /lib/libz.so.5
#11 0x293e51f4 in Java_java_util_zip_Inflater_inflateBytes (env=0x29657d04, 
    this=0xbf8fd23c, b=0xbf8fd238, off=0, len=2540)
    at ../../../src/share/native/java/util/zip/Inflater.c:128
[...]
(gdb) f 9
#9  0x29131f59 in inflate_fast (bl=1544798720, bd=2540, tl=0x17, 
    td=0x5c14c06c, s=0x5c14c058, z=0x5c14c2f0)
    at ../../../src/share/native/java/util/zip/zlib-1.1.3/inffast.c:53
53        ml = inflate_mask[bl];
(gdb) p inflate_mask
$1 = {0, 1, 3, 7, 15, 31, 63, 127, 255, 511, 1023, 2047, 4095, 8191, 16383, 
  32767, 65535}
(gdb) f 10
#10 0x293f115c in inflate () from /lib/libz.so.5
(gdb)

Things I find notable above:
    - inflate_fast() first arg bl is very large, especially compared
      to the size of the array inflate_mask

    - inflate_fast() is from the port's inffast.c, but is called
      from the system libz in frame 10.

    - the system libz (/usr/src/lib/libz/...) inflate_fast() has
      completely different arguments; the first arg in the system
      inflate_fast() is a pointer.

I am about to go digging into how java is built but I'm at square 0.
It seems java ought to pull inflate() and inflate_fast() from the
same library, but it's not (why?). Furthermore, maybe it would be
better to use the system libz entirely. I'm not sure how to make that
happen.

Is it a bug in the way the port is built? I have seen sporadic
mention of a similar problem elsewhere on the net but I haven't
found a solution:

    http://www.open-java.info/1/6/266181.html
    http://www.freebsd.org/cgi/query-pr.cgi?pr=119654 (entry of 25 Feb 2009)
    http://www.freebsd.org/cgi/query-pr.cgi?pr=138728

Suggestions welcome!

thanks,

 ~!paul
-- 
G. Paul Ziemba
FreeBSD unix:
12:21AM  up 26 days, 57 mins, 24 users, load averages: 0.02, 0.04, 0.07


More information about the freebsd-java mailing list