Apply timeout logging to scheduled executor service - #4948
Conversation
Signed-off-by: Andrew Fiddian-Green <software@whitebear.ch>
Signed-off-by: Andrew Fiddian-Green <software@whitebear.ch>
|
@andrewfg FYI: You can retrieve and inspect the queue, and some basic info like the number of running threads from the thread pools themselves. That might be "a less involved way" to monitor them than to send "test tasks" through the pipeline regularly. |
|
I am trying to avoid adding an extra monitor task to monitor the other tasks. So I just want to let each task monitor itself. |
|
But don't you need a task to inject the monitoring tasks? |
There was a problem hiding this comment.
Pull Request Overview
This PR adds timeout logging functionality to the task scheduler to monitor long-running scheduled tasks. If a scheduled task exceeds 5 seconds, it logs a debug message with the stack trace showing where the task was originally created.
- Implements timing wrapper classes for Runnable and Callable objects
- Overrides all schedule methods to wrap tasks with timeout monitoring
- Captures stack traces at task creation time for debugging purposes
|
If the idea is to wrap all tasks in a wrapper that measures timing, I'm pretty sure this will much more expensive than having a monitoring thread keeping an eye on the pools. I thought you were only planning on sending "probing tasks" through the pool at intervals. The ability to grab the stack trace probably requires some form of wrapping, but is it really worth the extra cost and complexity? |
No. |
Signed-off-by: Andrew Fiddian-Green <software@whitebear.ch>
I modified it so we only wrap the tasks if |
holgerfriedrich
left a comment
There was a problem hiding this comment.
LGTM, thanks.
Interesting approach.
|
This pull request has been mentioned on openHAB Community. There might be relevant details there: https://community.openhab.org/t/openhab-5-0-release-discussion/165032/237 |
|
This pull request has been mentioned on openHAB Community. There might be relevant details there: https://community.openhab.org/t/openhab-5-0-release-discussion/165032/244 |
|
This pull request has been mentioned on openHAB Community. There might be relevant details there: https://community.openhab.org/t/openhab-5-1-milestone-discussion/166385/55 |
If scheduled tasks take longer than a certain period of time to complete, and the log level is debug, then a message is output in the log together with the stack trace showing where the task was created.
Resolves #4947
One would activate the logging via
Signed-off-by: Andrew Fiddian-Green software@whitebear.ch