New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Scheduler stalls #312
Comments
The latest version of the sonos plugin is subject to a memory leak coming from the SoCo framework. As far as I know, it has not been adressed yet. See more details here: |
Yesterday I increased the maximum number of threads to 30. Today, I got I have now turned debugging on and hope that the problem can be reproduced soon. |
The scheduler is only the messenger of the bad news, not the source (what the title of your issue implys). The source has to be searched in one of the plugins you use.
|
Plugins in use:
I have been using THZ & GPIO for months now without problems. Problems occurred with update to 1.5.1. But maybe it could also be the Telegram plugin which I added a few days before the update. I'll disable the Telegram plugin now. If it is the reason for the issue then the daily scheduler stalls should disappear. For completeness here the active threads according to the log file:
|
I've taken your posts and sorted the threads in the message to get a better overview. The other |
@realhik, is this the first log entry about reaching the maximum number of threads or just the last one? Usually this message is logged whenever a new thread is created but maximum already reached. Is there any reason why the THZ plugin has 30 threads? Currently there's no implementation available in the plugins repo to review the code, but I found an old PR smarthomeNG/plugins#116. Maybe something changed in the core/scheduler which makes the plugin creating more threads then expected. |
@ohinckel, @bmxp, thank you for your hints. My log snippets each consider the first entry after a restart of SmarthomeNG. There are no peculiar entries around this log entry. However, I will try to debug the THZ Plugin which can be reviewed at github. Btw, I am user and not really maintainer of this helpful plugin. Just to understand the scheduler data: |
Ten days ago, I disabled the Telegram plugin and the problem occurred again yesterday. As I increased the number of threads the log file showed a huge number of scheduler entries: Above I gave the link to the source code of the THZ plugin. According to the method As an intermediate result, it seems that the THZ plugin or the maybe the scheduler is responsible. I'll try figure it out. Any hints are welcome |
Since the problem hits only you, I bet it is the THZ plugin (99.5% chance). Usually in plugins schedulers are added and the threads finish after thy have done their work. If needed, a new scheduler is added. The HUE plugin had the problem, that threads that encountered an error situation didn't terminate, so threads got created and created and created ... |
Yes, it is the THZ plugin and the reason that the number of threads increases has something to do with a broken serial communication. Usually, there subsequent requests and answers in the logs, e.g.:
However, after one point in time I could observe only requests every one second:
Polling all registers with a one second timeout takes longer than the cyclic execution of 30 seconds and the number of threads increase. So, @msinn, you were totally right. Btw, this malfunction will also affect other plugins as the maximum number of threads exceed. Maybe there is a way to make the scheduler more robust in case of erroneous plugin code... |
I am using SmartHomeNG and plugin version 1.5.1.
In the last weeks I observed a stalled scheduler queue for a few times. The system lags and execution times in the scheduler queue point to a timestamp in the past. In this case I have to restart SmarthomeNG to fix this.
In the smarthome.log I found the following lines which are probably related. The oldest entries in the scheduler queue point to 2019-03-02 11:48:44:
2019-03-02 11:46:47 ERROR sonos_discover_scheduler Method sonos_discover_scheduler exception: can't start new thread Traceback (most recent call last): File "/usr/local/smarthome/lib/scheduler.py", line 517, in _task obj() File "/usr/local/smarthome/plugins/sonos/__init__.py", line 2797, in _discover sonos_speaker[uid].check_subscriptions() File "/usr/local/smarthome/plugins/sonos/__init__.py", line 404, in check_subscriptions self.zone_subscription.subscribe() File "/usr/local/smarthome/plugins/sonos/__init__.py", line 178, in subscribe self._thread.start() File "/usr/lib/python3.5/threading.py", line 844, in start _start_new_thread(self._bootstrap, ()) RuntimeError: can't start new thread
and a few lines later:
2019-03-02 11:47:34 ERROR Scheduler Needing more worker threads than the specified maximum of 20!
It seems that the sonos plugin is the origin of this issue and the thread limit is only a subsequent problem. Any idea why this happens and how to fix it?
The text was updated successfully, but these errors were encountered: