fix(NotificationQueue): wakeUpAll() lost-wakeup race causes deadlock …#5214
Open
fix(NotificationQueue): wakeUpAll() lost-wakeup race causes deadlock …#5214
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes a shutdown-time deadlock in NotificationQueue by preventing a lost-wakeup race when wakeUpAll() happens before threads enter waitDequeueNotification().
Changes:
- Add
_wokeUpstate sowaitDequeueNotification()can return immediately if a priorwakeUpAll()occurred. - Add a new regression test that reproduces the “wakeUpAll before wait” scenario.
- Register the new test in the test suite.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| Foundation/testsuite/src/NotificationQueueTest.h | Declares the new regression test. |
| Foundation/testsuite/src/NotificationQueueTest.cpp | Implements and registers the regression test for the lost-wakeup scenario. |
| Foundation/src/NotificationQueue.cpp | Makes waitDequeueNotification*() return nullptr if _wokeUp was set, and sets _wokeUp in wakeUpAll(). |
| Foundation/include/Poco/NotificationQueue.h | Adds _wokeUp member to persist wakeup state across calls. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
23
to
24
|
|
||
|
|
There was a problem hiding this comment.
std::move is used later in this file, but <utility> is not included. Please add #include <utility> to ensure the file compiles portably without relying on transitive includes.
Suggested change
| #include <utility> |
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.
…on shutdown #5213