Multi-threaded plugins problem Topic is solved
Moderators: leecollings, remb0
Forum rules
Before posting here, make sure you are on the latest Beta or Stable version.
If you have problems related to the web gui, clear your browser cache + appcache first.
Use the following template when posting here:
Version: xxxx
Platform: xxxx
Plugin/Hardware: xxxx
Description:
.....
If you are having problems with scripts/blockly, always post the script (in a spoiler or code tag) or screenshots of your blockly
If you are replying, please do not quote images/code from the first post
Please mark your topic as Solved when the problem is solved.
Before posting here, make sure you are on the latest Beta or Stable version.
If you have problems related to the web gui, clear your browser cache + appcache first.
Use the following template when posting here:
Version: xxxx
Platform: xxxx
Plugin/Hardware: xxxx
Description:
.....
If you are having problems with scripts/blockly, always post the script (in a spoiler or code tag) or screenshots of your blockly
If you are replying, please do not quote images/code from the first post
Please mark your topic as Solved when the problem is solved.
-
mgugu
- Posts: 238
- Joined: Friday 04 November 2016 12:33
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Beta
- Location: France
- Contact:
Multi-threaded plugins problem
Pi2/Trixie - Domoticz: latest beta
Hi all,
I tested this multi-threaded plugin example :https://github.com/domoticz/domoticz/bl ... hreaded.py
Encountered issues:
- Domoticz hangs undefinitely when I click on update - Restarting domoticz service is very long
Other multithreaded plugins I tested have same kind of issues.
Are there some restrictions in using multi-threaded plugins ?
Hi all,
I tested this multi-threaded plugin example :https://github.com/domoticz/domoticz/bl ... hreaded.py
Encountered issues:
- Domoticz hangs undefinitely when I click on update - Restarting domoticz service is very long
Other multithreaded plugins I tested have same kind of issues.
Are there some restrictions in using multi-threaded plugins ?
- jvdz
- Posts: 2482
- Joined: Tuesday 30 December 2014 19:25
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 4.107
- Location: Netherlands
- Contact:
Re: Multi-threaded plugins problem
Do you get any messages in the log when you test as the OnStop() function should show you whether it is waiting for threads to finish?
-
mgugu
- Posts: 238
- Joined: Friday 04 November 2016 12:33
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Beta
- Location: France
- Contact:
Re: Multi-threaded plugins problem
Yes, on another multi-threaded plugin (Domoticz universal GPIO) I get following messages after service restart or hardware update:
And the still running thread is Mainthread
Code: Select all
2026-04-25 16:14:58.240 GPIO: GPIO event_loop exited
2026-04-25 16:14:58.242 Error: GPIO: Plugin has 1 Python threads still running.
2026-04-25 16:14:59.243 Error: GPIO: Plugin has 1 Python threads still running.
2026-04-25 16:15:00.244 Error: GPIO: Plugin has 1 Python threads still running.
2026-04-25 16:15:01.244 Error: GPIO: Plugin has 1 Python threads still running.
2026-04-25 16:15:02.245 Error: GPIO: Plugin has 1 Python threads still running.
2026-04-25 16:15:03.245 Error: GPIO: Plugin has 1 Python threads still running.
2026-04-25 16:15:04.246 Error: GPIO: Plugin has 1 Python threads still running.
2026-04-25 16:15:05.247 Error: GPIO: Plugin has 1 Python threads still running.
2026-04-25 16:15:06.247 Error: GPIO: Plugin has 1 Python threads still running.
2026-04-25 16:15:07.248 Error: GPIO: Plugin has 1 Python threads still running.
2026-04-25 16:15:08.248 Error: GPIO: Plugin has 1 Python threads still running.
2026-04-25 16:15:08.249 Error: GPIO: Plugin has 1 Python threads still running.
2026-04-25 16:15:08.249 Error: GPIO: Abandoning wait for Plugin thread shutdown, hang or crash may result.- jvdz
- Posts: 2482
- Joined: Tuesday 30 December 2014 19:25
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 4.107
- Location: Netherlands
- Contact:
Re: Multi-threaded plugins problem
The example plugin you linked does tell the thread to close by supplying a None into the messagequeue: self.messageQueue.put(None), so the thread knowns it needs to stop:
Have you done something similar?
Code: Select all
Message = self.messageQueue.get(block=True)
if Message is None:
Domoticz.Debug("Exiting message handler")
self.messageQueue.task_done()
break
-
Rik60
- Posts: 231
- Joined: Sunday 25 June 2023 21:54
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2026.3
- Location: The Netherlands
- Contact:
Re: Multi-threaded plugins problem
Can you check the plugin code:mgugu wrote: Saturday 25 April 2026 16:21 Yes, on another multi-threaded plugin (Domoticz universal GPIO) I get following messages after service restart or hardware update:And the still running thread is MainthreadCode: Select all
2026-04-25 16:14:58.240 GPIO: GPIO event_loop exited 2026-04-25 16:14:58.242 Error: GPIO: Plugin has 1 Python threads still running. 2026-04-25 16:14:59.243 Error: GPIO: Plugin has 1 Python threads still running. 2026-04-25 16:15:00.244 Error: GPIO: Plugin has 1 Python threads still running. 2026-04-25 16:15:01.244 Error: GPIO: Plugin has 1 Python threads still running. 2026-04-25 16:15:02.245 Error: GPIO: Plugin has 1 Python threads still running. 2026-04-25 16:15:03.245 Error: GPIO: Plugin has 1 Python threads still running. 2026-04-25 16:15:04.246 Error: GPIO: Plugin has 1 Python threads still running. 2026-04-25 16:15:05.247 Error: GPIO: Plugin has 1 Python threads still running. 2026-04-25 16:15:06.247 Error: GPIO: Plugin has 1 Python threads still running. 2026-04-25 16:15:07.248 Error: GPIO: Plugin has 1 Python threads still running. 2026-04-25 16:15:08.248 Error: GPIO: Plugin has 1 Python threads still running. 2026-04-25 16:15:08.249 Error: GPIO: Plugin has 1 Python threads still running. 2026-04-25 16:15:08.249 Error: GPIO: Abandoning wait for Plugin thread shutdown, hang or crash may result.
Code: Select all
if self.request.wait_edge_events(5):
copilot thinks that this is the problem
-
mgugu
- Posts: 238
- Joined: Friday 04 November 2016 12:33
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Beta
- Location: France
- Contact:
Re: Multi-threaded plugins problem
@jvdz, here is the multi-threaded GPIO plugin provided by Rik60, it provides error messages at restart while Multi-threaded Plugin example hangs
@Rik60, changing self.request.wait_edge_events(5) to (0.2) does not change anything.
I submitted the problem to Anthropic AI (also to improve inputs management) and he told me that the plugin is properly coded and the problem comes likely from domoticz mainthread management.
@Rik60, changing self.request.wait_edge_events(5) to (0.2) does not change anything.
I submitted the problem to Anthropic AI (also to improve inputs management) and he told me that the plugin is properly coded and the problem comes likely from domoticz mainthread management.
- Attachments
-
- Domoticz-Universal-GPIO.zip
- (2.9 KiB) Downloaded 97 times
-
Rik60
- Posts: 231
- Joined: Sunday 25 June 2023 21:54
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2026.3
- Location: The Netherlands
- Contact:
Re: Multi-threaded plugins problem
Perhaps it isn't the this plugin as you wrote. But the change worked for me. Btw, i have seen this error also when other plugin is stopping. Zigbee 4 Domoticz is also showing this error when Domoticz is restarting but i didn't pay attention to it.
- gizmocuz
- Posts: 3026
- Joined: Thursday 11 July 2013 18:59
- Target OS: Raspberry Pi / ODroid
- Domoticz version: beta
- Location: Top of the world
- Contact:
Re: Multi-threaded plugins problem
@Rik60, yes Zigbee4domoticz has know issues, and are solved when using a new python version, but that is not officially supported
Quality outlives Quantity!
- gizmocuz
- Posts: 3026
- Joined: Thursday 11 July 2013 18:59
- Target OS: Raspberry Pi / ODroid
- Domoticz version: beta
- Location: Top of the world
- Contact:
Re: Multi-threaded plugins problem
Should be solved when using the latest docker compose beta image (upgraded to python 3.13)
Quality outlives Quantity!