Bug #32816 Ndbj test case does not work
Submitted: 28 Nov 2007 13:58 Modified: 20 Dec 2007 13:38
Reporter: Oli Sennhauser Email Updates:
Status: Closed Impact on me:
None 
Category:Connectors: NDB/Bindings Severity:S3 (Non-critical)
Version:0.5.6.3.6.1 OS:Any
Assigned to: Monty Taylor CPU Architecture:Any

[28 Nov 2007 13:58] Oli Sennhauser
Description:
We have downloaded and installed the newest version of ndb connectors: 0.5.6.3.6.1

The BaseNdbjTestCase does not work.

How to repeat:
export CLASSPATH=/opt/NdbMgmApiTest/ndb-connectors-0.5.6.3.6.1/java:/opt/NdbMgmApiTest/ndb-connectors-0.5.6.3.6.1/java/testsuite:/opt/NdbMgmApiTest/ndb-connectors-0.5.6.3.6.1/java/lib/junit.jar:/opt/NdbMgmApiTest/ndb-connectors-0.5.6.3.6.1/java/lib/mysql-connector-java-5.0.4-bin.jar

export LD_LIBRARY_PATH=/usr/local/lib

/usr/bin/java testsuite/BaseNdbjTestCase   # 1.6.0_01

Exception in thread "main" java.lang.UnsatisfiedLinkError: /usr/local/lib/libndbj.so.0.0.0: /usr/local/lib/libndbj.so.0.0.0: cannot open shared object file: No such file or directory
        at java.lang.ClassLoader$NativeLibrary.load(Native Method)
        at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1751)
        at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1676)
        at java.lang.Runtime.loadLibrary0(Runtime.java:823)
        at java.lang.System.loadLibrary(System.java:1030)
        at testsuite.BaseNdbjTestCase.<clinit>(BaseNdbjTestCase.java:34)

java testsuite/BaseNdbjTestCase            # 1.5.0.12

Exception in thread "main" java.lang.UnsupportedClassVersionError: Bad version number in .class file
        at java.lang.ClassLoader.defineClass1(Native Method)

Suggested fix:
no idea
[28 Nov 2007 14:00] Oli Sennhauser
ldd /usr/local/lib/libndbj.so.0.0.0
        libmysqlclient_r.so.16 => /usr/local/mysql-5.1.22-ndb-6.3.6-telco-linux-x86_64/lib/libmysqlclient_r.so.16 (0x0000002a956df000)
        libz.so.1 => /usr/lib64/libz.so.1 (0x0000002a959d8000)
        libcrypt.so.1 => /lib64/libcrypt.so.1 (0x0000002a95aeb000)
        libnsl.so.1 => /lib64/libnsl.so.1 (0x0000002a95c20000)
        libpthread.so.0 => /lib64/tls/libpthread.so.0 (0x0000002a95d37000)
        libndbclient.so.3 => /usr/local/mysql-5.1.22-ndb-6.3.6-telco-linux-x86_64/lib/libndbclient.so.3 (0x0000002a95e4c000)
        libstdc++.so.6 => /usr/lib64/libstdc++.so.6 (0x0000002a96079000)
        libm.so.6 => /lib64/tls/libm.so.6 (0x0000002a96269000)
        libc.so.6 => /lib64/tls/libc.so.6 (0x0000002a963ef000)
        libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x0000002a96624000)
        /lib64/ld-linux-x86-64.so.2 (0x000000552aaaa000)
[28 Nov 2007 16:38] Hartmut Holzgraefe
Can't reproduce on linux x86 or x86_64 using 

- on 32bit

  java version "1.6.0_02"
  Java(TM) SE Runtime Environment (build 1.6.0_02-b05)
  Java HotSpot(TM) Client VM (build 1.6.0_02-b05, mixed mode, sharing)

- on 64bit

  java version "1.6.0"
  Java(TM) SE Runtime Environment (build 1.6.0-b105)
  Java HotSpot(TM) 64-Bit Server VM (build 1.6.0-b105, mixed mode)

both PATH and JAVA_HOME point at the 1.6 jdk

trying to run the test suite fails with

  $ java testsuite/BaseNdbjTestCase 
  Exception in thread "main" java.lang.NoSuchMethodError: main

but the JNI library and all other shared libraries it depends
on are loaded just fine according to strace:

  [pid 17735] open("/usr/local/lib/libndbj.so.0.0.0", O_RDONLY) = 7
  [pid 17735] read(7, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\340\17\2"..., 832) = 832
  [pid 17735] fstat(7, {st_mode=S_IFREG|0755, st_size=1141874, ...}) = 0
  [pid 17735] mmap(NULL, 2464592, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 7, 0) = 0x2aaad7eda000

so here the library is mmap'ed just fine instead of being closed again righ after the read ...
[28 Nov 2007 16:40] Hartmut Holzgraefe
Snippet from the original strace that i was refering to:

[pid 10976] open("/usr/local/lib/libndbj.so.0.0.0", O_RDONLY) = 7
[pid 10976] read(7, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\320J\2\0"..., 512) = 512
[pid 10976] close(7)
[28 Nov 2007 16:41] Hartmut Holzgraefe
Hm, looking at the strace snippet again i wonder about the different length arguments in the read() syscall? (832 vs. 512 bytes)
[29 Nov 2007 0:20] Monty Taylor
So BaseNdbjTestCase is just that... as base class. It's not intended to be run by itself. 

If you want to run the whole test suite, I recommend looking at 

testsuite.ndbj.AllTests

make check will actually run the AllTests test suite. 

There are currently 3 errors and 7 failures in the test suite...
[29 Nov 2007 15:25] Claudio Castigliola
If I execute:
java testsuite/ndbj/AllTests

result:
Exception in thread "main" java.lang.NoSuchMethodError: main

this means that the class AllTest don't contain method main.
[29 Nov 2007 16:46] Hartmut Holzgraefe
hmpf ... wrong package version ... updaged from 0.5.6.3.5.5 to 0.5.6.3.6.1 now

now i'm getting:

make[3]: Entering directory `/home/hartmut/projects/mysql/csc/21135/ndb-connectors-0.5.6.3.6.1/java'
/usr/lib/java/jdk1.6.0_03/bin/java -Djava.library.path=./.libs  -Dcom.mysql.jdbc.testsuite.url=jdbc:mysql://localhost/test -classpath .:./lib/mysql-connector-java-5.0.4-bin.jar:./lib/junit.jar  junit.textui.TestRunner testsuite.ndbj.AllTests
#
# An unexpected error has been detected by Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x42924180, pid=19054, tid=1075743664
#
# Java VM: Java HotSpot(TM) Client VM (1.6.0_03-b05 mixed mode, sharing)
# Problematic frame:
# C  [libmysqlclient_r.so.16+0x8e180]  _db_enter_+0x3e
#
# An error report file with more information is saved as hs_err_pid19054.log
#
# If you would like to submit a bug report, please visit:
#   http://java.sun.com/webapps/bugreport/crash.jsp
#
make[3]: *** [check-local] Aborted

System: 
  x86 32bit SuSE 10.0

Java: 
  java version "1.6.0_03"
  Java(TM) SE Runtime Environment (build 1.6.0_03-b05)
  Java HotSpot(TM) Client VM (build 1.6.0_03-b05, mixed mode, sharing)

MySQL:
  ndb-6.3.6
  compiled using BUILD/compile-pentium-debug-max
[29 Nov 2007 16:47] Hartmut Holzgraefe
jvm error report file

Attachment: hs_err_pid19054.log (text/x-log), 18.48 KiB.

[29 Nov 2007 16:55] Hartmut Holzgraefe
gdb backtrace:

#0  0xffffe410 in __kernel_vsyscall ()
#1  0x40079541 in raise () from /lib/tls/libc.so.6
#2  0x4007adbb in abort () from /lib/tls/libc.so.6
#3  0x0630804b in os::abort () from /usr/lib/jvm/java-1.4.2-sun-1.4.2.13/jdk1.6.0_03/jre/lib/i386/client/libjvm.so
#4  0x063b1ea1 in VMError::report_and_die () from /usr/lib/jvm/java-1.4.2-sun-1.4.2.13/jdk1.6.0_03/jre/lib/i386/client/libjvm.so
#5  0x0630c640 in JVM_handle_linux_signal () from /usr/lib/jvm/java-1.4.2-sun-1.4.2.13/jdk1.6.0_03/jre/lib/i386/client/libjvm.so
#6  0x06309ed8 in signalHandler () from /usr/lib/jvm/java-1.4.2-sun-1.4.2.13/jdk1.6.0_03/jre/lib/i386/client/libjvm.so
#7  <signal handler called>
#8  0x42924180 in _db_enter_ (_func_=0x42c607ac "NdbMutex_Create", _file_=0x42c607a1 "NdbMutex.c", _line_=27, _sfunc_=0x401e6418, 
    _sfile_=0x401e6414, _slevel_=0x401e6410, _sframep_=0x401e640c) at dbug.c:944
#9  0x42c27c6a in NdbMutex_Create () at NdbMutex.c:27
#10 0x42c24741 in Logger (this=0x42c71430) at Logger.cpp:48
#11 0x42c064fd in EventLogger (this=0x42c71420) at EventLogger.cpp:1106
#12 0x42be5b20 in __static_initialization_and_destruction_0 (__initialize_p=1, __priority=65535) at ndb_cluster_connection.cpp:35
#13 0x42be5b5b in global constructors keyed to g_eventLogger () at ndb_cluster_connection.cpp:787
#14 0x42c3e2c6 in __do_global_ctors_aux () from /usr/local/mysql-ndb-6.3.6/lib/mysql/libndbclient.so.3
#15 0x42b6ba25 in _init () from /usr/local/mysql-ndb-6.3.6/lib/mysql/libndbclient.so.3
#16 0x4000b9a4 in call_init () from /lib/ld-linux.so.2
#17 0x4000bae1 in _dl_init_internal () from /lib/ld-linux.so.2
#18 0x40142ed1 in dl_open_worker () from /lib/tls/libc.so.6
#19 0x4000b82f in _dl_catch_error () from /lib/ld-linux.so.2
#20 0x40143546 in _dl_open () from /lib/tls/libc.so.6
#21 0x4004ed68 in dlopen_doit () from /lib/libdl.so.2
#22 0x4000b82f in _dl_catch_error () from /lib/ld-linux.so.2
#23 0x4004f37e in _dlerror_run () from /lib/libdl.so.2
#24 0x4004edc1 in dlopen@@GLIBC_2.1 () from /lib/libdl.so.2
#25 0x0630827a in os::dll_load () from /usr/lib/jvm/java-1.4.2-sun-1.4.2.13/jdk1.6.0_03/jre/lib/i386/client/libjvm.so
#26 0x06274400 in JVM_LoadLibrary () from /usr/lib/jvm/java-1.4.2-sun-1.4.2.13/jdk1.6.0_03/jre/lib/i386/client/libjvm.so
#27 0x40263cac in Java_java_lang_ClassLoader_00024NativeLibrary_load ()
   from /usr/lib/jvm/java-1.4.2-sun-1.4.2.13/jdk1.6.0_03/jre/lib/i386/libjava.so
[29 Nov 2007 16:55] Hartmut Holzgraefe
and "bt full":

#0  0xffffe410 in __kernel_vsyscall ()
No symbol table info available.
#1  0x40079541 in raise () from /lib/tls/libc.so.6
No symbol table info available.
#2  0x4007adbb in abort () from /lib/tls/libc.so.6
No symbol table info available.
#3  0x0630804b in os::abort () from /usr/lib/jvm/java-1.4.2-sun-1.4.2.13/jdk1.6.0_03/jre/lib/i386/client/libjvm.so
No symbol table info available.
#4  0x063b1ea1 in VMError::report_and_die () from /usr/lib/jvm/java-1.4.2-sun-1.4.2.13/jdk1.6.0_03/jre/lib/i386/client/libjvm.so
No symbol table info available.
#5  0x0630c640 in JVM_handle_linux_signal () from /usr/lib/jvm/java-1.4.2-sun-1.4.2.13/jdk1.6.0_03/jre/lib/i386/client/libjvm.so
No symbol table info available.
#6  0x06309ed8 in signalHandler () from /usr/lib/jvm/java-1.4.2-sun-1.4.2.13/jdk1.6.0_03/jre/lib/i386/client/libjvm.so
No symbol table info available.
#7  <signal handler called>
No symbol table info available.
#8  0x42924180 in _db_enter_ (_func_=0x42c607ac "NdbMutex_Create", _file_=0x42c607a1 "NdbMutex.c", _line_=27, _sfunc_=0x401e6418, 
    _sfile_=0x401e6414, _slevel_=0x401e6410, _sframep_=0x401e640c) at dbug.c:944
        save_errno = 2
        cs = (CODE_STATE *) 0x616d6d6f
#9  0x42c27c6a in NdbMutex_Create () at NdbMutex.c:27
        pNdbMutex = (NdbMutex *) 0x4016e8e8
        result = 1120042012
        _db_func_ = 0x80cd308 ""
        _db_file_ = 0x4000b2c0 "ZY\207\004$�b"
        _db_level_ = 1075733576
        _db_framep_ = (char **) 0x42b1a000
        __PRETTY_FUNCTION__ = "NdbMutex_Create"
#10 0x42c24741 in Logger (this=0x42c71430) at Logger.cpp:48
No locals.
#11 0x42c064fd in EventLogger (this=0x42c71420) at EventLogger.cpp:1106
No locals.
#12 0x42be5b20 in __static_initialization_and_destruction_0 (__initialize_p=1, __priority=65535) at ndb_cluster_connection.cpp:35
No locals.
#13 0x42be5b5b in global constructors keyed to g_eventLogger () at ndb_cluster_connection.cpp:787
No locals.
#14 0x42c3e2c6 in __do_global_ctors_aux () from /usr/local/mysql-ndb-6.3.6/lib/mysql/libndbclient.so.3
No symbol table info available.
#15 0x42b6ba25 in _init () from /usr/local/mysql-ndb-6.3.6/lib/mysql/libndbclient.so.3
No symbol table info available.
#16 0x4000b9a4 in call_init () from /lib/ld-linux.so.2
No symbol table info available.
#17 0x4000bae1 in _dl_init_internal () from /lib/ld-linux.so.2
No symbol table info available.
#18 0x40142ed1 in dl_open_worker () from /lib/tls/libc.so.6
No symbol table info available.
#19 0x4000b82f in _dl_catch_error () from /lib/ld-linux.so.2
No symbol table info available.
#20 0x40143546 in _dl_open () from /lib/tls/libc.so.6
[...]
[29 Nov 2007 17:39] Hartmut Holzgraefe
Ok, got it running on AMD64, debian-unstable now, 
"make check" on the top level dir of 0.5.6.3.6.1 
works, but i'm getting 3 errors and 9 failures, not 7 ...

will upload "make check" output log to this bug report
[29 Nov 2007 17:41] Hartmut Holzgraefe
output log from "make check"

Attachment: make-check-log.txt (text/plain), 393.68 KiB.

[30 Nov 2007 8:08] Claudio Castigliola
System: 
  x86_64 GNU/Linux

Java: 
  java version "1.6.0_01"
  Java(TM) SE Runtime Environment (build 1.6.0_01-b06)
  Java HotSpot(TM) Server VM (build 1.6.0_01-b06, mixed mode)

MySQL:
  ndb-6.3.6

Command list:
./configure --with-mysql=/usr/local/mysql-5.1.22-ndb-6.3.6-telco-linux-x86_64 --with-python=no

make

echo $CLASSPATH
/opt/NdbMgmApiTest/ndb-connectors-0.5.6.3.6.1/java/ndbj.jar:/opt/NdbMgmApiTest/ndb-connectors-0.5.6.3.6.1/java/lib/junit.jar:
/opt/NdbMgmApiTest/ndb-connectors-0.5.6.3.6.1/java/lib/mysql-connector-java-5.0.4-bin.jar

make check
Making check in swig
make[1]: Entering directory `/opt/NdbMgmApiTest/ndb-connectors-0.5.6.3.6.1/swig'
cd ../swig/SWIG && make
make[2]: Entering directory `/opt/NdbMgmApiTest/ndb-connectors-0.5.6.3.6.1/swig/SWIG'
make[3]: Entering directory `/opt/NdbMgmApiTest/ndb-connectors-0.5.6.3.6.1/swig/SWIG/Source'
make  all-am
make[4]: Entering directory `/opt/NdbMgmApiTest/ndb-connectors-0.5.6.3.6.1/swig/SWIG/Source'
cp -f ../Source/eswig ../swig
make[4]: Leaving directory `/opt/NdbMgmApiTest/ndb-connectors-0.5.6.3.6.1/swig/SWIG/Source'
make[3]: Leaving directory `/opt/NdbMgmApiTest/ndb-connectors-0.5.6.3.6.1/swig/SWIG/Source'
make[2]: Leaving directory `/opt/NdbMgmApiTest/ndb-connectors-0.5.6.3.6.1/swig/SWIG'
make  check-local
make[2]: Entering directory `/opt/NdbMgmApiTest/ndb-connectors-0.5.6.3.6.1/swig'
cd ../swig/SWIG && true #make  check
make[2]: Leaving directory `/opt/NdbMgmApiTest/ndb-connectors-0.5.6.3.6.1/swig'
make[1]: Leaving directory `/opt/NdbMgmApiTest/ndb-connectors-0.5.6.3.6.1/swig'
Making check in java
make[1]: Entering directory `/opt/NdbMgmApiTest/ndb-connectors-0.5.6.3.6.1/java'
make  check-am
make[2]: Entering directory `/opt/NdbMgmApiTest/ndb-connectors-0.5.6.3.6.1/java'
make  check-local
make[3]: Entering directory `/opt/NdbMgmApiTest/ndb-connectors-0.5.6.3.6.1/java'
/opt/SDK/jdk/bin/java -Djava.library.path=./.libs  -Dcom.mysql.jdbc.testsuite.url=jdbc:mysql://localhost/test -classpath .:./
lib/mysql-connector-java-5.0.4-bin.jar:./lib/junit.jar  junit.textui.TestRunner testsuite.ndbj.AllTests
Failed to invoke suite():java.lang.UnsatisfiedLinkError: /opt/NdbMgmApiTest/ndb-connectors-0.5.6.3.6.1/java/.libs/libndbj.so.
0.0.0: /opt/NdbMgmApiTest/ndb-connectors-0.5.6.3.6.1/java/.libs/libndbj.so.0.0.0: cannot open shared object file: No such fil
e or directory
make[3]: *** [check-local] Error 1
make[3]: Leaving directory `/opt/NdbMgmApiTest/ndb-connectors-0.5.6.3.6.1/java'
make[2]: *** [check-am] Error 2
make[2]: Leaving directory `/opt/NdbMgmApiTest/ndb-connectors-0.5.6.3.6.1/java'
make[1]: *** [check] Error 2
make[1]: Leaving directory `/opt/NdbMgmApiTest/ndb-connectors-0.5.6.3.6.1/java'
make: *** [check-recursive] Error 1

ls -lrt java/.libs/
total 9484
-rw-r--r--  1 root root 1892440 Nov 30 08:57 libndbj_la-ndbj.o
-rwxr-xr-x  1 root root 1331232 Nov 30 08:57 libndbj.so.0.0.0
lrwxrwxrwx  1 root root      16 Nov 30 08:57 libndbj.so.0 -> libndbj.so.0.0.0
lrwxrwxrwx  1 root root      16 Nov 30 08:57 libndbj.so -> libndbj.so.0.0.0
-rw-r--r--  1 root root     981 Nov 30 08:57 libndbj.lai
lrwxrwxrwx  1 root root      13 Nov 30 08:57 libndbj.la -> ../libndbj.la
-rw-r--r--  1 root root 1969084 Nov 30 08:57 libndbj.a
-rw-r--r--  1 root root 1590512 Nov 30 08:57 libmgmj_la-mgmj.o
-rwxr-xr-x  1 root root 1148930 Nov 30 08:57 libmgmj.so.0.0.0
lrwxrwxrwx  1 root root      16 Nov 30 08:57 libmgmj.so.0 -> libmgmj.so.0.0.0
lrwxrwxrwx  1 root root      16 Nov 30 08:57 libmgmj.so -> libmgmj.so.0.0.0
-rw-r--r--  1 root root     981 Nov 30 08:57 libmgmj.lai
lrwxrwxrwx  1 root root      13 Nov 30 08:57 libmgmj.la -> ../libmgmj.la
-rw-r--r--  1 root root 1674628 Nov 30 08:57 libmgmj.a

Any suggestion?
Thanks.
[1 Dec 2007 2:15] Monty Taylor
Whoops. I gave bad advice... Here is the result of me running make check. I have only tested running make check in the java dir so far... Also, the error here is from my Ctrl-C

mtaylor@solace:~/src/ndb-connectors/telco-6.3/java$ make check 
make  check-am
make[1]: Entering directory `/home/mtaylor/src/ndb-connectors/telco-6.3/java'
Building NDB/J java files
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Building ndbj.jar
make  check-local
make[2]: Entering directory `/home/mtaylor/src/ndb-connectors/telco-6.3/java'
/usr/lib/jvm/java-6-sun/bin/java -Djava.library.path=./.libs  -Dcom.mysql.jdbc.testsuite.url=jdbc:mysql://localhost/test -classpath .:./lib/mysql-connector-java-5.0.4-bin.jar:./lib/junit.jar  junit.textui.TestRunner testsuite.ndbj.AllTests
.Running test: testsuite.ndbj.NdbOperationByteLongTest
make[2]: *** [check-local] Error 130
make[1]: *** [check-am] Interrupt
make: *** [check] Interrupt

But the more important thing to note is that we actually run AllTests through the junit test runner. So it _should_ be: 

/usr/lib/jvm/java-6-sun/bin/java -Djava.library.path=./.libs  -Dcom.mysql.jdbc.testsuite.url=jdbc:mysql://localhost/test -classpath .:./lib/mysql-connector-java-5.0.4-bin.jar:./lib/junit.jar  junit.textui.TestRunner testsuite.ndbj.AllTests

Also, this all works quite well in eclipse. If you run the make in the java dir first, this will generate the autogenerated code. Then in eclipse you can run the unit tests using the junit abilities of eclipse... if you're in to that sort of thing. 

And Hartmut, I agree. I would rather it is make test... but automake seems to prefer make check for some reason.
[20 Dec 2007 13:38] Monty Taylor
As of 0.5.6.3.6.6 building is working properly. The whole suite has been built multiple times on the launchpad autobuilder farm with no problems.