- Notifications
You must be signed in to change notification settings - Fork750
Closed
Description
If we embed Python.Net into DotNet application, it crashes on Linux.
Crash occurs when application exits.
PythonEngine.Initialize();try{using(Py.GIL()){dynamicsysModule=Py.Import("sys");Console.WriteLine("Python engine version:");Console.WriteLine(sysModule.version);}// This workaround reduces risk of Mono crash.// Problem will be fixed in mono 4.6if(Type.GetType("Mono.Runtime")!=null){Runtime.Py_Main(3,new[]{"/pcfgtest.exe","-c","exit"});}else{// Program will crash if we will try to do this under Windows.//// Runtime.Py_Main(3, new[] { "/pcfgtest.exe", "-c", "exit" });}}finally{PythonEngine.Shutdown();}
This is sample of code that produces crash.
Also it contains 'probably workaround".
Console output :
tux@pythonnet:/mnt/Projects/pythonnet/2/src/configtest/bin/Release$ mono pcfgtest.exeStarting application...Python.runtime.dll substituted by Python.Runtime-Py35-Linux64.dll.Python engine version:3.5.2 (default, Jul 5 2016, 12:43:10)[GCC 5.4.0 20160609]Shutting down finalizer thread timed out.* Assertion at gc.c:867, condition`finalizer_thread_exited' not metStacktrace:Native stacktrace: mono() [0x4a77ca] /lib/x86_64-linux-gnu/libpthread.so.0(+0x113d0) [0x7f48084463d0] /lib/x86_64-linux-gnu/libc.so.6(gsignal+0x38) [0x7f4807e8b418] /lib/x86_64-linux-gnu/libc.so.6(abort+0x16a) [0x7f4807e8d01a] mono() [0x6408c9] mono() [0x640ad7] mono() [0x640c26] mono() [0x5aee5e] mono(mono_runtime_cleanup+0xe) [0x5a85de] mono() [0x423cf7] mono(mono_main+0x10d7) [0x47a087] mono() [0x421818] /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf0) [0x7f4807e76830] mono() [0x421c11]Debug info from gdb:=================================================================Got a SIGABRT while executing native code. This usually indicatesa fatal error in the mono runtime or one of the native librariesused by your application.=================================================================Aborted (core dumped)
I tried everything - python 2.7, python 3.5, Mono 4.2, 4.4.
It does not matter, behavior always the same.
Also i tried to build with Py_DEBUG under linux (and pass python library from python3.5-dbg package)
I receive assertions on PythonEngine.Init:
- Decref -1 Assertions
- td_type != NULL Assertion
Metadata
Metadata
Assignees
Labels
No labels