Page 1 of 1

Python plugin Segmentation fault

Posted: Tuesday 26 January 2021 19:11
by meyland
I have a strange problem. I'm trying to develop af Python Plugin and every time i change ant parameters the plugin creates a segmentation fault. Even the base plugin template create a seg. fault when stopping the plugin. The log shows this:

Code: Select all

2021-01-26 18:55:05.541  (Test) Processing 'onStopCallback' message
2021-01-26 18:55:05.541  (Test) Calling message handler 'onStop'.
2021-01-26 18:55:05.541  (Test) ==================================================
2021-01-26 18:55:05.541  (Test) onStop called
Fatal Python error: Segmentation fault

Thread 0x00007f0f14621880 (most recent call first):
<no Python frame>
2021-01-26 18:55:05.545  Error: Domoticz(pid:413010, tid:413013('PluginMgr')) received fatal signal 11 (Segmentation fault)
2021-01-26 18:55:05.545  Error: siginfo address=0x64d52, address=0x7f0f145dc065
2021-01-26 18:55:05.559  Error: Failed to start gdb, will use backtrace() for printing stack frame

2021-01-26 18:55:05.578  Error: #0  /home/users/peterm/udvikling/domoticz/domoticz_test/usr/bin/domoticz() [0xdc4e2c]
2021-01-26 18:55:05.578  Error: #1  /home/users/peterm/udvikling/domoticz/domoticz_test/usr/bin/domoticz() [0xdc50a4]
2021-01-26 18:55:05.578  Error: #2  /home/users/peterm/udvikling/domoticz/domoticz_test/usr/bin/domoticz : signal_handler(int, siginfo_t*, void*) + 0x216 [0xdc52bd]
2021-01-26 18:55:05.578  Error: #3  /lib64/libpthread.so.0 :  + 0x141e0 [0x7f0f145dc1e0]
2021-01-26 18:55:05.578  Error: #4  /lib64/libpthread.so.0 : raise + 0x145 [0x7f0f145dc065]
2021-01-26 18:55:05.578  Error: #5  /lib64/libpthread.so.0 :  + 0x141e0 [0x7f0f145dc1e0]
2021-01-26 18:55:05.578  Error: #6  /lib64/libpython3.9.so : PyEval_ReleaseLock + 0x19 [0x7f0f1368cde0]
2021-01-26 18:55:05.578  Error: #7  /home/users/peterm/udvikling/domoticz/domoticz_test/usr/bin/domoticz : Plugins::CPlugin::Stop() + 0x128 [0x122fe8a]
2021-01-26 18:55:05.578  Error: #8  /home/users/peterm/udvikling/domoticz/domoticz_test/usr/bin/domoticz : Plugins::onStopCallback::ProcessLocked() + 0x38 [0x12335d8]
2021-01-26 18:55:05.578  Error: #9  /home/users/peterm/udvikling/domoticz/domoticz_test/usr/bin/domoticz : Plugins::CPluginMessageBase::Process() + 0x45 [0xd00d03]
2021-01-26 18:55:05.578  Error: #10 /home/users/peterm/udvikling/domoticz/domoticz_test/usr/bin/domoticz : Plugins::CPluginSystem::Do_Work() + 0x339 [0x1239bb5]
2021-01-26 18:55:05.578  Error: #11 /home/users/peterm/udvikling/domoticz/domoticz_test/usr/bin/domoticz : void std::__invoke_impl<void, void (Plugins::CPluginSystem::*)(), Plugins::CPluginSystem*>(std::__invoke_memfun_deref, void (Plugins::CPluginSystem::*&&)(), Plugins::CPluginSystem*&&) + 0x67 [0x123ffa3]
2021-01-26 18:55:05.578  Error: #12 /home/users/peterm/udvikling/domoticz/domoticz_test/usr/bin/domoticz : std::__invoke_result<void (Plugins::CPluginSystem::*)(), Plugins::CPluginSystem*>::type std::__invoke<void (Plugins::CPluginSystem::*)(), Plugins::CPluginSystem*>(void (Plugins::CPluginSystem::*&&)(), Plugins::CPluginSystem*&&) + 0x37 [0x123fee5]
2021-01-26 18:55:05.578  Error: #13 /home/users/peterm/udvikling/domoticz/domoticz_test/usr/bin/domoticz : void std::thread::_Invoker<std::tuple<void (Plugins::CPluginSystem::*)(), Plugins::CPluginSystem*> >::_M_invoke<0ul, 1ul>(std::_Index_tuple<0ul, 1ul>) + 0x43 [0x123fe55]
2021-01-26 18:55:05.578  Error: #14 /home/users/peterm/udvikling/domoticz/domoticz_test/usr/bin/domoticz : std::thread::_Invoker<std::tuple<void (Plugins::CPluginSystem::*)(), Plugins::CPluginSystem*> >::operator()() + 0x18 [0x123fe0e]
2021-01-26 18:55:05.578  Error: #15 /home/users/peterm/udvikling/domoticz/domoticz_test/usr/bin/domoticz : std::thread::_State_impl<std::thread::_Invoker<std::tuple<void (Plugins::CPluginSystem::*)(), Plugins::CPluginSystem*> > >::_M_run() + 0x1c [0x123fd7e]
2021-01-26 18:55:05.578  Error: #16 /lib64/libstdc++.so.6 :  + 0xd65f4 [0x7f0f1433e5f4]
2021-01-26 18:55:05.578  Error: #17 /lib64/libpthread.so.0 :  + 0x93f9 [0x7f0f145d13f9]
2021-01-26 18:55:05.578  Error: #18 /lib64/libc.so.6 : clone + 0x43 [0x7f0f14031903]
_test_run_domoticz.sh: line 42: 413010 Segmentation fault      (core dumped) ${_PRG_TEST} -approot $USERDATA -www $WWW_PORT -sslwww $SSL_PORT -sslcert $SSLCERT -sslpass $SSLPASS -sslmethod $SSLMETHOD -ssloptions $SSLOPTIONS -ssldhparam $SSLDHPARAM -wwwroot $WWW_ROOT -dbase $DBASE -userdata $USERDATA -verbose $VERBOSE -log $LOG -loglevel $LOGLEVEL -debug
domoticz (build 12839) are homecompiled on a fully updated Fedora 33 system with this commandline:

Code: Select all

   
cmake CMakeLists.txt \
      -DUSE_STATIC_LIBSTDCXX=NO           \
      -DUSE_STATIC_OPENZWAVE=YES          \
      -DUSE_STATIC_BOOST=NO               \
      -DUSE_OPENSSL_STATIC=NO             \
      -DUSE_BUILTIN_MQTT=NO               \
      -DUSE_BUILTIN_SQLITE=NO
make
Can someone tell me what I'm doing wrong og tell me what I'm missing

Re: Python plugin Segmentation fault

Posted: Saturday 30 January 2021 10:33
by meyland
I have now installed the package "gdb" on my Fedora 33, so I could get som more debug info. I have attached the log and all I've did was selecting the plugin and clicked the update button

I've also did a fresh install of Fedora and a fresh compile of Domoticz on the newly create machine with the same result: Segmentation fault.

What can I do to solve the frustrating problem?

Re: Python plugin Segmentation fault

Posted: Saturday 30 January 2021 10:50
by waaren
meyland wrote: Saturday 30 January 2021 10:33 What can I do to solve the frustrating problem?
It is a known and reported issue when using Python 3.9.1 in combination with Python plugins. See issue 4487. If you can downgrade to 3.9.0 that would prevent the crashes for now and when someone with the required skills and enough time at hand has solved the root cause you can update to a later Python version again

Re: Python plugin Segmentation fault

Posted: Saturday 30 January 2021 11:06
by meyland
Thanks for the answer. I will try downgrading Python