Python plugin (slide-domoticz) crashes domoticz with signal 11

Python and python framework

Moderator: leecollings

Post Reply
User avatar
heggink
Posts: 994
Joined: Tuesday 08 September 2015 21:44
Target OS: Raspberry Pi / ODroid
Domoticz version: 12451
Location: NL
Contact:

Python plugin (slide-domoticz) crashes domoticz with signal 11

Post by heggink »

Every now and then, the slide-domoticz plugin crashes domoticz with a signal-11 on Plugin_ASIO. It only seems to happen when I open or close all slides at the same time. I noticed in another topic (https://www.domoticz.com/forum/viewtopi ... IO#p243653) the same behaviour but cannot seem to figure out what the cause is.

The plugin can be found here: https://github.com/lokonli/slide-domoti ... /plugin.py

@dnpwwo: could you take a quick look like you did with the other crash and see if you can detect anything conspicuous?

Input greatly appreciated.

H
Docker in Truenas scale, close to latest beta
RFXCOM 433 and 868, zigbee2mqtt,
P1 meter & solar panel
User avatar
heggink
Posts: 994
Joined: Tuesday 08 September 2015 21:44
Target OS: Raspberry Pi / ODroid
Domoticz version: 12451
Location: NL
Contact:

Re: Python plugin (slide-domoticz) crashes domoticz with signal 11

Post by heggink »

turns out multiple successive http connect requests (6x in a row) messes up the pythoin plugin crashing domoticz with a seg fault :-(.
Docker in Truenas scale, close to latest beta
RFXCOM 433 and 868, zigbee2mqtt,
P1 meter & solar panel
User avatar
Dnpwwo
Posts: 820
Joined: Sunday 23 March 2014 9:00
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Melbourne, Australia
Contact:

Re: Python plugin (slide-domoticz) crashes domoticz with signal 11

Post by Dnpwwo »

Hi heggink,

I don't believe that the two topics are related, UDP and TCP and implemented using separate code and the TCP code is much more mature due to it's high usage.

The Plugin_ASIO thread handles all of the ASynchronous Input Output for the Plugin Framework (technically it is one of a pool of threads but the pool size is currently set to 1) but mostly it handles connections and incoming data because TCP writes are synchronous for performance reasons.

In the absense of a stack trace I've had a look at the code and have questions around line 227:
if self.myConn.Connected() & (self.access_token != ''):
and (IMHO) there are 2 things wrong with this statement:
  • The two conditions are very losely connected which is bad. If the access token is blank why does this statement trigger a reconnect in the else? It may still be connected
  • but more importantly I don't a Python bit wise '&' operation is what was intended here. Shouldn't this be an 'and' comparison? I suspect this drives a lot of unnecessary reconnection.
The reasonable man adapts himself to the world; the unreasonable one persists to adapt the world to himself. Therefore all progress depends on the unreasonable man. George Bernard Shaw
User avatar
heggink
Posts: 994
Joined: Tuesday 08 September 2015 21:44
Target OS: Raspberry Pi / ODroid
Domoticz version: 12451
Location: NL
Contact:

Re: Python plugin (slide-domoticz) crashes domoticz with signal 11

Post by heggink »

Hey Dnpwwo,

Many thanks for the reply! I already changed the "&" into "and".
When you say "the 2 topics", which 2 topics do you mean?

Thanks again!

H
Docker in Truenas scale, close to latest beta
RFXCOM 433 and 868, zigbee2mqtt,
P1 meter & solar panel
Post Reply