[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#635894: marked as done (libgomp1: Linking a JNI library with openmp makes std::cerr::operator<< crash)



Your message dated Sat, 13 Feb 2016 11:24:42 +0100
with message-id <56BF046A.90602@debian.org>
and subject line Re: Bug#635894: libgomp1: Linking a JNI library with openmp makes std::cerr::operator<< crash
has caused the Debian Bug report #635894,
regarding libgomp1: Linking a JNI library with openmp makes std::cerr::operator<< crash
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact owner@bugs.debian.org
immediately.)


-- 
635894: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=635894
Debian Bug Tracking System
Contact owner@bugs.debian.org with problems
--- Begin Message ---
Package: libgomp1
Version: 4.6.1-4
Severity: important

When linking a C++ library which will be used with JNI with openmp, this
makes std::cerr::operator<< crashes when this library is used inside a
JVM.

A test case is provided in the .tar.gz available here:
http://public.geekou.info/jni-openmp.tar.gz .

It contains a library (libtestcerr.so) that implements a JNI interface,
the Java class that goes with that interface, a Makefile and a small
bash script to execute the test.

The default Makefile compiles the library with g++ and links it with
OpenMP :

$ make
javac TestCerr.java
g++ -shared -fPIC -fopenmp -lgomp TestCerr.cpp -o libtestcerr.so

When launching the Java class, whose main function simply calls a function
inside the library that calls std::cerr::<<, a segfault happens:

$ cat launch.sh 
#!/bin/bash
LD_LIBRARY_PATH=. gdb --args java TestCerr
$ ./launch.sh
$ ./launch.sh 
GNU gdb (GDB) 7.2-debian
[...]
Reading symbols from /usr/bin/java...(no debugging symbols found)...done.
(gdb) r
Starting program: /usr/bin/java TestCerr
[Thread debugging using libthread_db enabled]
process 5313 is executing new program: /usr/lib/jvm/java-6-openjdk/jre/bin/java
[Thread debugging using libthread_db enabled]
[New Thread 0x7ffff7fcd700 (LWP 5316)]
[New Thread 0x7ff7fe441700 (LWP 5317)]
[New Thread 0x7ff7fe340700 (LWP 5318)]
[New Thread 0x7ff7fe23f700 (LWP 5319)]
[New Thread 0x7ff7fe13e700 (LWP 5320)]
[New Thread 0x7ff7fe03d700 (LWP 5321)]
[New Thread 0x7ff7fdf3c700 (LWP 5322)]
[New Thread 0x7ff7fde3b700 (LWP 5323)]
[New Thread 0x7ff7fdd3a700 (LWP 5324)]
[New Thread 0x7ff7fdc39700 (LWP 5325)]
[New Thread 0x7ff7fdb38700 (LWP 5326)]
[New Thread 0x7ff7fda37700 (LWP 5327)]
[New Thread 0x7ff7fd936700 (LWP 5328)]
[New Thread 0x7ff7fd835700 (LWP 5329)]
[New Thread 0x7ff7fd734700 (LWP 5330)]
[New Thread 0x7ff7fd633700 (LWP 5331)]
[New Thread 0x7ff7fd532700 (LWP 5332)]
[New Thread 0x7ff7fd431700 (LWP 5333)]
[New Thread 0x7ff7fd330700 (LWP 5334)]
[New Thread 0x7ff7f7cfc700 (LWP 5335)]
[New Thread 0x7ff7f7bfb700 (LWP 5336)]
[New Thread 0x7ff7f7afa700 (LWP 5337)]
[New Thread 0x7ff7f780a700 (LWP 5338)]
[New Thread 0x7ff7f7709700 (LWP 5339)]
[New Thread 0x7ff7f7608700 (LWP 5340)]
[New Thread 0x7ff7f7507700 (LWP 5341)]
[New Thread 0x7ff7f7406700 (LWP 5342)]
hi to cout
hi to cerr
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7ffff7fcd700 (LWP 5316)]
0x00007ff7f6c9f189 in std::uncaught_exception() () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
(gdb) bt
#0  0x00007ff7f6c9f189 in std::uncaught_exception() () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#1  0x00007ff7f6c7ecc8 in std::basic_ostream<char, std::char_traits<char> >& std::__ostream_insert<char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*, long) () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#2  0x00007ff7f6c7f05f in std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*) () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#3  0x00007ff7f70fa96a in Java_TestCerr_show_1cerr () from /home/aguinet/dev/jni/libtestcerr.so
#4  0x00007ffff222ec48 in ?? ()
#5  0x00007ffff7fcc790 in ?? ()
#6  0x00007ff8050cb1a8 in ?? ()
#7  0x00007ffff7fcc7e8 in ?? ()
#8  0x00007ff8050cb610 in ?? ()
#9  0x0000000000000000 in ?? ()
(gdb) 

Please note that OpenJDK is used, but the same thing happens with Sun's JDK.

If the library is compiled without OpenMP support, everything runs fine :

(after changing the Makefile)
$ make
javac TestCerr.java
g++ -shared -fPIC TestCerr.cpp -o libtestcerr.so
$ ./launch.sh
$ ./launch.sh 
GNU gdb (GDB) 7.2-debian
[...]
Reading symbols from /usr/bin/java...(no debugging symbols found)...done.
(gdb) r
Starting program: /usr/bin/java TestCerr
[Thread debugging using libthread_db enabled]
process 5467 is executing new program: /usr/lib/jvm/java-6-openjdk/jre/bin/java
[Thread debugging using libthread_db enabled]
[New Thread 0x7ffff7fcd700 (LWP 5470)]
[New Thread 0x7ff7fe441700 (LWP 5471)]
[New Thread 0x7ff7fe340700 (LWP 5472)]
[New Thread 0x7ff7fe23f700 (LWP 5473)]
[New Thread 0x7ff7fe13e700 (LWP 5474)]
[New Thread 0x7ff7fe03d700 (LWP 5475)]
[New Thread 0x7ff7fdf3c700 (LWP 5476)]
[New Thread 0x7ff7fde3b700 (LWP 5477)]
[New Thread 0x7ff7fdd3a700 (LWP 5478)]
[New Thread 0x7ff7fdc39700 (LWP 5479)]
[New Thread 0x7ff7fdb38700 (LWP 5480)]
[New Thread 0x7ff7fda37700 (LWP 5481)]
[New Thread 0x7ff7fd936700 (LWP 5482)]
[New Thread 0x7ff7fd835700 (LWP 5483)]
[New Thread 0x7ff7fd734700 (LWP 5484)]
[New Thread 0x7ff7fd633700 (LWP 5485)]
[New Thread 0x7ff7fd532700 (LWP 5486)]
[New Thread 0x7ff7fd431700 (LWP 5487)]
[New Thread 0x7ff7fd330700 (LWP 5488)]
[New Thread 0x7ff7f7cfc700 (LWP 5489)]
[New Thread 0x7ff7f7bfb700 (LWP 5490)]                                                                                                                                                                                                                                         
[New Thread 0x7ff7f7afa700 (LWP 5491)]                                                                                                                                                                                                                                         
[New Thread 0x7ff7f780a700 (LWP 5492)]                                                                                                                                                                                                                                         
[New Thread 0x7ff7f7709700 (LWP 5493)]                                                                                                                                                                                                                                         
[New Thread 0x7ff7f7608700 (LWP 5494)]                                                                                                                                                                                                                                         
[New Thread 0x7ff7f7507700 (LWP 5495)]                                                                                                                                                                                                                                         
[New Thread 0x7ff7f7406700 (LWP 5496)]                                                                                                                                                                                                                                         
hi to cout                                                                                                                                                                                                                                                                     
hi to cerr                                                                                                                                                                                                                                                                     
hi                                                                                                                                                                                                                                                                             
                                                                                                                                                                                                                                                                               
[Thread 0x7ff7f7406700 (LWP 5496) exited]                                                                                                                                                                                                                                      
[Thread 0x7ff7f780a700 (LWP 5492) exited]                                                                                                                                                                                                                                      
[Thread 0x7ff7f7507700 (LWP 5495) exited]                                                                                                                                                                                                                                      
[Thread 0x7ff7f7608700 (LWP 5494) exited]                                                                                                                                                                                                                                      
[Thread 0x7ff7f7709700 (LWP 5493) exited]                                                                                                                                                                                                                                      
[Thread 0x7ff7f7afa700 (LWP 5491) exited]                                                                                                                                                                                                                                      
[Thread 0x7ff7f7bfb700 (LWP 5490) exited]                                                                                                                                                                                                                                      
[Thread 0x7ff7fd330700 (LWP 5488) exited]                                                                                                                                                                                                                                      
[Thread 0x7ff7fd431700 (LWP 5487) exited]                                                                                                                                                                                                                                      
[Thread 0x7ff7fd532700 (LWP 5486) exited]                                                                                                                                                                                                                                      
[Thread 0x7ff7fd633700 (LWP 5485) exited]                                                                                                                                                                                                                                      
[Thread 0x7ff7fd734700 (LWP 5484) exited]                                                                                                                                                                                                                                      
[Thread 0x7ff7fd835700 (LWP 5483) exited]                                                                                                                                                                                                                                      
[Thread 0x7ff7fd936700 (LWP 5482) exited]                                                                                                                                                                                                                                      
[Thread 0x7ff7fda37700 (LWP 5481) exited]                                                                                                                                                                                                                                      
[Thread 0x7ff7fdb38700 (LWP 5480) exited]                                                                                                                                                                                                                                      
[Thread 0x7ff7fdc39700 (LWP 5479) exited]                                                                                                                                                                                                                                      
[Thread 0x7ff7fdd3a700 (LWP 5478) exited]                                                                                                                                                                                                                                      
[Thread 0x7ff7fde3b700 (LWP 5477) exited]                                                                                                                                                                                                                                      
[Thread 0x7ff7fdf3c700 (LWP 5476) exited]                                                                                                                                                                                                                                      
[Thread 0x7ff7fe03d700 (LWP 5475) exited]                                                                                                                                                                                                                                      
[Thread 0x7ff7fe13e700 (LWP 5474) exited]                                                                                                                                                                                                                                      
[Thread 0x7ff7fe23f700 (LWP 5473) exited]                                                                                                                                                                                                                                      
[Thread 0x7ff7fe340700 (LWP 5472) exited]                                                                                                                                                                                                                                      
[Thread 0x7ff7fe441700 (LWP 5471) exited]                                                                                                                                                                                                                                      
[Thread 0x7ffff7fcd700 (LWP 5470) exited]
(gdb) 

Also, if icc is used instead of gcc, no crashes happen (that's why I reported
this bug here and not to Sun/Oracle).
Moreover, I don't really know if this is a Debian specific bug or not, because
for now I only have access to Debian systems.

I also tried this on an up-to-date sid version of Debian, and the same thing happens.

I also tried to reproduce this bug outside of the Java/JNI environnement, but I
didn't manage to. That's why I also don't really know where the problem comes
from, or if there are issues on both sides !

-- System Information:
Debian Release: wheezy/sid
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.39-2-amd64 (SMP w/24 CPU cores)
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages libgomp1 depends on:
ii  gcc-4.6-base                  4.6.1-4    GCC, the GNU Compiler Collection (
ii  libc6                         2.13-10    Embedded GNU C Library: Shared lib
ii  multiarch-support             2.13-10    Transitional package to ensure mul

libgomp1 recommends no packages.

libgomp1 suggests no packages.

-- no debconf information



--- End Message ---
--- Begin Message ---
tags 635894 + wontfix
thanks

no feedback, closing; should be rechecked with GCC 6 from experimental.

--- End Message ---

Reply to: