I have a plugin that runs data collection every minute. Heartbeat is set to 30 seconds, since that is the max according to the wiki, and therefore every other heartbeat is skipped before data collection is starting again.
Sometimes the data collection, due to timeouts, runs longer than a minute and then I get the message "thread seems to have ended unexpectedly", I guess because a new call from heartbeat is started before the old one has finished.
The plugin continues normally after this error, so it is more like a warning, but anyway: How to avoid? Can I test whether the previous call has finished? Or should I just ignore?
preventing "thread seems to have ended unexpectedly"
Moderator: leecollings
- jvdz
- Posts: 2441
- Joined: Tuesday 30 December 2014 19:25
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 4.107
- Location: Netherlands
- Contact:
Re: preventing "thread seems to have ended unexpectedly"
The only way to avoid this is to have the heartbeat end timely and run the data retrieval part asynchronously.
There are a couple of plugins that use this method, and details can be found here: https://github.com/domoticz/domoticz/bl ... hreaded.py
The other option is to limit the time that website api call is allowed to take, when this long process only happens occasionally.
There are a couple of plugins that use this method, and details can be found here: https://github.com/domoticz/domoticz/bl ... hreaded.py
The other option is to limit the time that website api call is allowed to take, when this long process only happens occasionally.
-
willemd
- Posts: 735
- Joined: Saturday 21 September 2019 17:55
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2024.1
- Location: The Netherlands
- Contact:
Re: preventing "thread seems to have ended unexpectedly"
Thanks,
I now "solved" it by setting a "stillbusy" flag on the start and resetting it when finished. If the next heartbeat starts it checks that flag and skips if true, with a maximum number of skips set.
I now "solved" it by setting a "stillbusy" flag on the start and resetting it when finished. If the next heartbeat starts it checks that flag and skips if true, with a maximum number of skips set.
Who is online
Users browsing this forum: No registered users and 1 guest