Package: libopenmpt0 Version: 0.2.7386~beta20.3-3+deb9u4 Severity: important Tags: patch
Dear Maintainer, I am trying to load OpenCV from Java. However, OpenCV depends on ffmpeg and ffmpeg depends on libopenmpt0. Sadly, JVM segfaults when it attempts to load this library. The fix is described in bug #892272, but it was not applied to Debian stable. I have tried setting Xss Java option and also changing the ulimit stack size, but neither did help. However I do not think this is an OpenJDK bug. There are also some preexisting bug reports outside of Debian BTS: https://github.com/opencv/opencv/issues/10080 https://github.com/opencv/opencv/issues/10157 This is a backtrace of Java crashing: Thread 2 "java" received signal SIGSEGV, Segmentation fault. OpenMPT::CResamplerSettings::CResamplerSettings (this=0xb5bde858) at soundlib/Resampler.h:65 65 SrcMode = SRCMODE_POLYPHASE; (gdb) bt #0 OpenMPT::CResamplerSettings::CResamplerSettings (this=0xb5bde858) at soundlib/Resampler.h:65 #1 OpenMPT::CResampler::CResampler (fresh_generate=false, this=0xb5bde858) at soundlib/Resampler.h:109 #2 OpenMPT::ResampleCacheInitialzer::ResampleCacheInitialzer (this=0x9dcc4d58 <OpenMPT::g_ResamplerCachePrimer>) at soundlib/Tables.cpp:1030 #3 0xb6fdf124 in call_init (l=<optimized out>, argc=argc@entry=4, argv=argv@entry=0xbefff5b4, env=env@entry=0xbefff5c8) at dl-init.c:72 #4 0xb6fdf248 in call_init (env=<optimized out>, argv=<optimized out>, argc=<optimized out>, l=<optimized out>) at dl-init.c:30 #5 _dl_init (main_map=main_map@entry=0xa2092608, argc=4, argv=0xbefff5b4, env=0xbefff5c8) at dl-init.c:120 #6 0xb6fe3ca8 in dl_open_worker (a=<optimized out>) at dl-open.c:575 #7 0xb6fdefb4 in _dl_catch_error (objname=0xb5c3097c, objname@entry=0xb5c2ed4c, errstring=0xb5c2ede0, errstring@entry=0xb5c2ed50, mallocedp=0xb5c2ed4c, mallocedp@entry=0xb5c2ed4b, operate=0xb5c2ed50, args=args@entry=0xb5c2ed54) at dl-error.c:187 #8 0xb6fe345c in _dl_open (file=0xa24d1e08 "/usr/lib/jni/libopencv_java249.so", mode=-2147483647, caller_dlopen=0xb6883cf8 <os::dll_load(char const*, char*, int)+64>, nsid=-2, argc=4, argv=0xbefff5b4, env=0xbefff5c8) at dl-open.c:660 #9 0xb6f4db5c in dlopen_doit (a=0xb5c2efa0) at dlopen.c:66 #10 0xb6fdefb4 in _dl_catch_error (objname=0xb5c3097c, objname@entry=0xb5a00554, errstring=0x0, errstring@entry=0xb5a00558, mallocedp=0xb5a00554, mallocedp@entry=0xb5a00550, operate=0xb5a00558, operate@entry=0xb6f4dadc <dlopen_doit>, args=args@entry=0xb5c2efa0) at dl-error.c:187 #11 0xb6f4e310 in _dlerror_run (operate=0xb6f4dadc <dlopen_doit>, args=args@entry=0xb5c2efa0) at dlerror.c:163 #12 0xb6f4dc2c in __dlopen (file=file@entry=0xa24d1e08 "/usr/lib/jni/libopencv_java249.so", mode=mode@entry=1) at dlopen.c:87 #13 0xb6883cf8 in os::Linux::dlopen_helper (ebuflen=1024, ebuf=0xb5c2f040 "", filename=0xa24d1e08 "/usr/lib/jni/libopencv_java249.so") at /build/jdk/src/hotspot/os/linux/os_linux.cpp:1849 #14 os::dll_load (filename=filename@entry=0xa24d1e08 "/usr/lib/jni/libopencv_java249.so", ebuf=ebuf@entry=0xb5c2f040 "", ebuflen=ebuflen@entry=1024) at /build/jdk/src/hotspot/os/linux/os_linux.cpp:1682 #15 0xb65d9d64 in JVM_LoadLibrary (name=0xa24d1e08 "/usr/lib/jni/libopencv_java249.so") at /build/jdk/src/hotspot/share/prims/jvm.cpp:3445 #16 0xb5b8727c in Java_java_lang_ClassLoader_00024NativeLibrary_load0 (env=0xb5a10680, this=0xb5c2f9f8, name=0xb5c2f9f4, isBuiltin=<optimized out>) at /build/jdk/src/java.base/share/native/libjava/ClassLoader.c:353 #17 0xb38550a4 in ?? () Backtrace stopped: previous frame identical to this frame (corrupt stack?) I have rebuilt the libopenmpt0 package with the two patches from the previous issue and indeed, they solve the problem. https://github.com/OpenMPT/openmpt/commit/6f8f7be5848be8c4487b1779c332b802674f6747.patch https://github.com/OpenMPT/openmpt/commit/133007530cbe737f4b56db907aa6baee0ea5b17d.patch How to reproduce: - pick an ARM device with Debian Stretch userland - install java and libopencv2.4-java - try running https://github.com/ev3dev-lang-java/examples/blob/master/opencv/src/main/java/example/opencv/HelloWorldCV.java Summary: * I want to be able to do an equivalent of dlopen() on this library from HotSpot JVM. * I expect the call to succeed. * What happens instead is that the call causes a segmentation fault. This is probably due to a stack overflow in the library on initialization. * evasive.gy...@gmail.com had found a fix for this issue in two upstream commits, details are above. Thanks, Jakub Vanek -- System Information: Debian Release: 9.6 APT prefers stable-debug APT policy: (500, 'stable-debug'), (500, 'stable') Architecture: armel (armv7l) Kernel: Linux 4.14.78-150 (SMP w/8 CPU cores; PREEMPT) Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968) (ignored: LC_ALL set to C), LANGUAGE=C (charmap=ANSI_X3.4-1968) (ignored: LC_ALL set to C) Shell: /bin/sh linked to /bin/dash Init: systemd (via /run/systemd/system) Versions of packages libopenmpt0 depends on: ii libc6 2.24-11+deb9u3 ii libgcc1 1:6.3.0-18+deb9u1 ii libmpg123-0 1.23.8-1+b1 ii libstdc++6 6.3.0-18+deb9u1 ii libvorbis0a 1.3.5-4+deb9u2 ii libvorbisfile3 1.3.5-4+deb9u2 ii zlib1g 1:1.2.8.dfsg-5 libopenmpt0 recommends no packages. libopenmpt0 suggests no packages. -- no debconf information