Reputation: 3403
I have a Python script that uses natural language date parser Natty. Natty itself is written in Java but wrapped for its use in Python using Jpype. The script works perfectly fine on my development machine but throws an segmentation fault on the production machine:
>>> import natty
Segmentation fault (core dumped)
On both machines, using pip freeze
I get the same version of relevant modules:
...
JPype==0.5.4.2
JPype1==0.6.1
...
natty==0.2.4
...
On both machine, I run the same Python versions
>>> import sys
>>> print (sys.version)
2.7.12 (default, Nov 19 2016, 06:48:10)
[GCC 5.4.0 20160609]
On both machines, JAVA_HOME
is set to the same value
>echo $JAVA_HOME
/usr/lib/jvm/java-8-oracle
In short, I cannot spot any obvious differences. I found this Stackoverflow thread that lists causes for segmentation faults, but it didn't really help me. I kind of assume that it's a Java code wrapped using Jpype, but that's just a guess.
How can I hunt down that error?
EDIT: gdb python
gives me the following out put
(gdb) run ~/tmp/natty-test.py
Starting program: /usr/bin/python ~/tmp/natty-test.py
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Program received signal SIGSEGV, Segmentation fault.
0x00007fffe48bf2b4 in ?? ()
(gdb) backtrace
#0 0x00007fffe48bf2b4 in ?? ()
#1 0x0000000000000246 in ?? ()
#2 0x00007fffe48bf160 in ?? ()
#3 0x00007ffff5901990 in VM_Operation::_names ()
from /usr/lib/jvm/java-8-oracle/jre/lib/amd64/server/libjvm.so
#4 0x00007fffffffcf90 in ?? ()
#5 0x00007ffff543168d in VM_Version::get_processor_features() ()
from /usr/lib/jvm/java-8-oracle/jre/lib/amd64/server/libjvm.so
Backtrace stopped: previous frame inner to this frame (corrupt stack?)
natty-test.py
only contains import natty
Upvotes: 5
Views: 10083
Reputation: 11
Updating the kernel worked for me as well in OpenSUSE, but only after re-creating my virtual environment. I hope this helps somebody!
Upvotes: 0
Reputation: 3403
Solution: I had to update the Kernel of my Ubuntu installation on the production machine.
I noticed that Jpype already caused the problem
>>> import jpype
>>> jpype.startJVM(jpype.getDefaultJVMPath())
Segmentation fault
Searching for this problem brought me to this Stackoverflow thread and the included link to an AskUbuntu thread. The kernel on the production machine was 4.4.0-81-generic, one if the kernels mentioned there. After the update to 4.10.0-32-generic all works fine now.
Upvotes: 1