Skip to content

Fix dead lock on Timer destructor#3987

Merged
aleks-f merged 1 commit intopocoproject:develfrom
vojinilic:fixDeadLockDestructor
Mar 30, 2023
Merged

Fix dead lock on Timer destructor#3987
aleks-f merged 1 commit intopocoproject:develfrom
vojinilic:fixDeadLockDestructor

Conversation

@vojinilic
Copy link
Copy Markdown
Contributor

Consider following situation. A class owns a timer. In destructor of that class we call .cancel() asynchronous on timer before it's destruction. Now timer is executing cancel in it's own internal thread, while it's doing that destructor of timer is called from owning class. Timer destructor enqueues stop notification. If that enqueue is happening just after while loop from cancel notification, stop notification is gonna be dropped and timer will never stop.

fixes #3986

Consider following situation. A class owns a timer. In destructor of that class we call .cancel() asynchronous on timer before it's destruction.
Now timer is executing cancel in it's own internal thread, while it's doing that destructor of timer is called from owning class. Timer destructor enqueues stop notification. If that enqueue is happening just after while loop from cancel notification, stop notification is gonna be dropped and timer will never stop.

fixes pocoproject#3986
@aleks-f aleks-f added the bug label Mar 30, 2023
@aleks-f aleks-f added this to the Release 1.12.5 milestone Mar 30, 2023
@aleks-f aleks-f self-assigned this Mar 30, 2023
@aleks-f aleks-f merged commit 39a8b9a into pocoproject:devel Mar 30, 2023
aleks-f pushed a commit that referenced this pull request Mar 30, 2023
Consider following situation. A class owns a timer. In destructor of that class we call .cancel() asynchronous on timer before it's destruction.
Now timer is executing cancel in it's own internal thread, while it's doing that destructor of timer is called from owning class. Timer destructor enqueues stop notification. If that enqueue is happening just after while loop from cancel notification, stop notification is gonna be dropped and timer will never stop.

fixes #3986

Co-authored-by: Vojin Ilic <vilic@nvidia.com>
@vojinilic
Copy link
Copy Markdown
Contributor Author

Should I also cherry pick this to 1.12.5 or will that be handled by who ever releases 1.12.5?

vojinilic pushed a commit to vojinilic/poco that referenced this pull request Apr 2, 2023
vojinilic pushed a commit to vojinilic/poco that referenced this pull request Apr 2, 2023
aleks-f pushed a commit that referenced this pull request Apr 4, 2023
This reverts commit 39a8b9a.

Co-authored-by: Vojin Ilic <vilic@nvidia.com>
aleks-f pushed a commit that referenced this pull request Apr 4, 2023
This reverts commit 5124431.

Co-authored-by: Vojin Ilic <vilic@nvidia.com>
@vojinilic vojinilic deleted the fixDeadLockDestructor branch April 4, 2023 08:44
aleks-f pushed a commit that referenced this pull request Nov 27, 2023
Consider following situation. A class owns a timer. In destructor of that class we call .cancel() asynchronous on timer before it's destruction.
Now timer is executing cancel in it's own internal thread, while it's doing that destructor of timer is called from owning class. Timer destructor enqueues stop notification. If that enqueue is happening just after while loop from cancel notification, stop notification is gonna be dropped and timer will never stop.

fixes #3986

Co-authored-by: Vojin Ilic <vilic@nvidia.com>
aleks-f pushed a commit that referenced this pull request Nov 27, 2023
This reverts commit 39a8b9a.

Co-authored-by: Vojin Ilic <vilic@nvidia.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix dead lock on Timer destructor

2 participants