On Mon, 8 Aug 2016, Dmitry Nezhevenko wrote:

Hi,

I'm trying to figure out why pylucene fails to build on Debian on a lot of
architectures:

https://buildd.debian.org/status/package.php?p=pylucene

I've tried to debug it as much as possible and found that JCC crashes
inside native initVM call just inside JNI_CreateJavaVM.

Sometimes under certain conditions it works, but doesn't work when called
from debian package build script.

I've found that crash depends on number and content of environment
variables or command-line options (even if I commented out access to
sys.argv and os.environ).

Finally I've figured out that I don't need JCC python code at all to
reproduce it and got followed:

echo 'import jcc; jcc.initVM()' | python2.7 - 1 2 3 4 5 6 7 8 9 10 11 12
13 14 15 16 17 18 19 20 21 22 23
+0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901
+2345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012
+3456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123
+4567890123456789012345678901234567890123456789012345678901
NATIVE: initVM
NATIVE: initVM: 1
NATIVE: initVM: 3
NATIVE: initVM: 4
NATIVE: initVM: 6
NATIVE: initVM: 7!!!
NATIVE: initVM: 7. Calling JNI_CreateJavaVM
Segmentation fault

[ NATIVE: lines are just printf() calls I've added to native initVM
function ]

The magic happens in arguments. Just removing last '1' from last arg fixes
crash for me. Or just remove one symbol from any environment variables.

Unfortunately it crashes such way that I can't get call stack.

ltrace suggests me that crash happens just after reading /proc/self/maps
file. It's probably pthread_getattr_np() function.

I was trying to debug it step-by-step but with no luck for now (it works
if I'm just stepping after breaking at pthread_getattr_np call

I've also tried to remove all logic from initVM() and just copy/paste
JNI_CreateJavaVM usage from docs:

https://docs.oracle.com/javase/8/docs/technotes/guides/jni/spec/invocation.html

and it still crashes. Playing with -Xmx -Xms, -Xss doesn't help at all.

Any suggestions about cause of this and possible solution?

No one replied to your question so far. I don't have much to add since I have no access to your platform and can't reproduce any of this to debug it. It looks like the symptoms you describe could hint at a version mismatch between the headers you use to compile (and the libs to link) and then the ones you use at runtime. Maybe version skew or 32-bit vs 64-bit (?) or different frameworks.
Sorry for not having anything more useful to say.

Andi..


--
WBR, Dmitry

Reply via email to