Conversation
Fix high idle CPU usage when OVMS is running as a Windows Service. The service supervisor invokes a non-blocking poll causing its thread to run even when the server itself is idle; replacing it with finite event wait that periodically checks server state and readiness while waking immediately when the stop event is signaled, with an atomic fallback, ensures that a failure to signal the event cannot leave the worker indefinitely running in SERVICE_STOP_PENDING. Additionally, create the service stop event before starting the worker thread, removing a startup race in which the worker could see the wrapper's initial invalid handle value, and harden Windows service error path.
Author
|
The Windows service idle CPU usage issue is trivially verifiable to be real. As for lifecycle change, I prepared a reproduction to show that the issue in current model server code is legitimate: error_ownership_repro.txt The mock server returns only after TearDown requests shutdown, making the overwritten-error example deterministic and free of concurrent writes. |
rasapala
self-requested a review
September 17, 2026 07:10
3 tasks
Author
|
Closing in favor of #4578 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix high idle CPU usage when OVMS is running as a Windows Service. The service supervisor invokes a non-blocking poll causing its thread to run even when the server itself is idle; replacing it with finite event wait that periodically checks server state and readiness while waking immediately when the stop event is signaled, with an atomic fallback, ensures that a failure to signal the event cannot leave the worker indefinitely running in SERVICE_STOP_PENDING.
Additionally, create the service stop event before starting the worker thread, removing a startup race in which the worker could see the wrapper's initial invalid handle value, and propagate failures through the Windows service status instead of always reporting a successful stop, while preserving the originating Win32 error for diagnostics.
🧪 Checklist