Segmentation fault in using JNI_CreateJavaVM with paddle
Created by: rmalav15
Hey,
We are using DeepSpeech in our project using provided docker image. First of all, terrific work in both PaddlePaddle and DeepSpeech.
To reproduce the error, we made a sample github repo. For the project requirement we need to use JNI_CreateJavaVM to use java jar classes in our c++ code, which is in turn will be used in DeepSpeech python code using swig wrapper.
When we run demo test.py (which doesn't import paddle), it runs prefectly. But when we add import paddle:
import gfg
import paddle.v2 as paddle
print gfg.fact(5)
print gfg.my_mod(3,4)
#gfg.vm()
gfg.main()
and run it, we get:
120
3
using pool:)
Segmentation fault (core dumped)
The stack trace is this (When we used JNI_CreateJavaVM in DeepSpeech Code):
Received utterance[length=245760] from 10.158.19.119, saved to demo_cache/20180504155105_10.158.19.119.wav. *** Aborted at 1525449065 (unix time) try "date -d @1525449065" if you are using GNU date *** PC: @ 0x0 (unknown) *** SIGSEGV (@0x50) received by PID 7060 (TID 0x7fde57e0a700) from PID 80; stack trace: *** @ 0x7fde579e6390 (unknown) @ 0x7fde57bfe73c (unknown) @ 0x7fde57c07851 (unknown) @ 0x7fde57c02564 (unknown) @ 0x7fde57c06da9 (unknown) @ 0x7fde57407f09 (unknown) @ 0x7fde57c02564 (unknown) @ 0x7fde57408571 (unknown) @ 0x7fde57407fa1 dlopen @ 0x7fde133fce75 os::Linux::clock_init() @ 0x7fde13400049 os::init() @ 0x7fde1354cca2 Threads::create_vm() @ 0x7fde131aae64 JNI_CreateJavaVM @ 0x7fde13daf06e create_vm() @ 0x7fde13daf2dc main_fn() @ 0x7fde13d46af8 _wrap_main_fn @ 0x4c468a PyEval_EvalFrameEx @ 0x4c2765 PyEval_EvalCodeEx @ 0x4ca099 PyEval_EvalFrameEx @ 0x4c2765 PyEval_EvalCodeEx @ 0x4ca8d1 PyEval_EvalFrameEx @ 0x4c2765 PyEval_EvalCodeEx @ 0x4ca8d1 PyEval_EvalFrameEx @ 0x4c9d8f PyEval_EvalFrameEx @ 0x4c2765 PyEval_EvalCodeEx @ 0x4de6fe (unknown) @ 0x4b0cb3 PyObject_Call @ 0x4f492e (unknown) @ 0x4b0cb3 PyObject_Call @ 0x4ce5d0 PyEval_CallObjectWithKeywords @ 0x4e17e4 PyInstance_New @ 0x4b0cb3 PyObject_Call Segmentation fault (core dumped)
This sounds weird, but its actually happening.
It looks like there is some problem in using threads. The JNI_CreateJavaVM function description says that it "Loads and initializes a Java VM. The current thread becomes the main thread." Which is I think causing the problem. (I am not sure, I may be completely wrong).
Please let us know why its happening, It will be huge help.
Much Thanks