Revert "Fix dead lock on Timer destructor (#3987)"#3994
Merged
aleks-f merged 1 commit intopocoproject:develfrom Apr 4, 2023
Merged
Revert "Fix dead lock on Timer destructor (#3987)"#3994aleks-f merged 1 commit intopocoproject:develfrom
aleks-f merged 1 commit intopocoproject:develfrom
Conversation
This reverts commit 39a8b9a.
Member
|
The original fix actually made sense because I've experienced some problems in the past that could be because of that; it seems that what is missing here is a way to shut down the notification queue to prevent it from accepting further notifications. Or return In any case, if you want to revert this, send the 1.12.5 revert pull also. I would prefer it being properly fixed, but I don't have time for it myself. |
Contributor
Author
|
Here is a pull request for 1.12.5 as well.
#3995
As for proper fix in the current state of the code I have an idea.
Instead of returning false or blocking we can do the following.
Add a new method in NotificationQueue similar to dequeueNotification but
instead of returning a task which needs to be executed now that it returns
the next task in queue regardless of when it needs to be executed. Let's
call that method dequeueNextNotification, I am not stuck on naming it's
just for reference now.
Execution of Cancel notification would turn to something like this then.
size_t pendingSize = queue().size();
while (pendingSize > 0)
{
Poco::AutoPtr<TimerNotification> pNf =
static_cast<TimerNotification*>(queue().dequeueNextNotification());
pendingSize--;
...
}
So we would get the size of pending tasks when we start to execute Cancel.
We want to dequeue that many notifications regardless of when they need to
be executed. We flush one by one taking special consideration of stop and
cancel tasks as before. After we leave the while loop we will again remove
the clear() method.
Does that make sense?
I can also write all of that down in the issue itself, and possibly take
care of that in the coming weeks.
Vojin Ilic
…On Sun, 2 Apr 2023 at 17:24, Aleksandar Fabijanic ***@***.***> wrote:
The original fix actually made sense because I've experienced some
problems in the past that could be because of that; it seems that what is
missing here is a way to shut down the notification queue to prevent it
from accepting further notifications. Or return false at the end of
CancelNotification::execute()
In any case, if you want to revert this, send the 1.12.5 revert pul also.
I would prefer it being properly fixed, but I don't have time for it myself.
—
Reply to this email directly, view it on GitHub
<#3994 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ALAADTJXXERWDVH7LGF2HSTW7GKZLANCNFSM6AAAAAAWQJAHWM>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Member
|
@vojinilic make a new pull with your proposal and we'll look into it. I know testing is often not easy with async and timed stuff, but having tests would definitely be beneficial. |
aleks-f
pushed a commit
that referenced
this pull request
Nov 27, 2023
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.
This reverts commit 39a8b9a.
It actually brakes cancel since dequeueNotification only returns notification which is due to execute now.
And there is no test which checks if notifications is executed after cancel.
fixes #3986