Skip to content

Merge v1.x.x (v1.13.1) into v2.x.x - #627

Merged
llucax merged 5 commits into
frequenz-floss:v2.x.xfrom
llucax:merge-v1.13.1-into-v2
Nov 26, 2026
Merged

llucax merged 5 commits into
frequenz-floss:v2.x.xfrom
llucax:merge-v1.13.1-into-v2

Conversation

@llucax

@llucax llucax commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Brings the timer cancellation fix from #625 (released in v1.13.1) to v2.x.x, with the release notes for v2.0.1. The release notes entry drops the mention of the deprecated Timer, which v2 doesn't have.

Fixes #624.

After waking up, `ready()` cancels the task it is no longer waiting
for and awaits it, catching its `CancelledError`. If the task running
`ready()` is itself cancelled while it awaits there, the `except`
clause catches that cancellation too. After a reset, `ready()` then
goes back to sleeping until the next tick, so a `select()` or service
being stopped can hang for a whole timer interval. After a tick, the
cancellation is lost and `ready()` returns as if nothing happened.

Wait for the cancelled tasks with `asyncio.wait()` instead. It doesn't
raise the tasks' exceptions, but it still raises `CancelledError` when
the task running `ready()` is cancelled.

The new test cancels `ready()` at several loop iterations after a
reset and after a tick, so it doesn't depend on exactly when the
cleanup happens. Without the fix, it fails for 3 and 4 iterations in
both cases.

The deprecated `Timer` is an alias of `MonotonicTimer`, so it's fixed
too.

Signed-off-by: Leandro Lucarella <luca-frequenz@llucax.com>
Cancelling a task waiting in `MonotonicTimer.ready()` right after the
timer was reset or ticked could be ignored, because the cleanup of the
task `ready()` stopped waiting for also caught the caller's own
`CancelledError`. The commit message has the details.

Fixes frequenz-floss#624.
Add a summary and remove the template comments and the empty sections,
as the release process requires before tagging.

Signed-off-by: Leandro Lucarella <luca-frequenz@llucax.com>
Adds a summary and removes the template comments and the empty sections,
so v1.13.1 can be tagged. The only change in this release is frequenz-floss#625.
This merges `v1.x.x` (aa72a4c, v1.13.1) into `v2.x.x`, so v2 gets the
fix for timers ignoring the cancellation of a task waiting on them
(frequenz-floss#625), to be released as v2.0.1.

There were no conflicts. The only change on top of the merge is in
`RELEASE_NOTES.md`: the bug fix entry no longer mentions the deprecated
`Timer` alias, since v2 doesn't have it.

Signed-off-by: Leandro Lucarella <luca-frequenz@llucax.com>
@llucax llucax added this to the v2.0.1 milestone Nov 25, 2026
@github-actions github-actions Bot added part:docs Affects the documentation part:tests Affects the unit, integration and performance (benchmarks) tests part:utilities Affects the utility receivers (`Timer`, `Event`, `FileWatcher`) labels Nov 25, 2026
@llucax
llucax marked this pull request as ready for review November 25, 2026 10:14
@llucax
llucax requested a review from a team as a code owner November 25, 2026 10:14
@llucax
llucax requested review from daniel-zullo-frequenz and removed request for a team November 25, 2026 10:14
@llucax llucax self-assigned this Nov 25, 2026
@llucax
llucax requested review from Marenz and shsms November 25, 2026 10:14
@llucax
llucax enabled auto-merge November 25, 2026 10:14
@llucax

llucax commented Nov 25, 2026

Copy link
Copy Markdown
Contributor Author

BTW, this is just porting the timer cancellation fix to v2.x.x.

@llucax
llucax added this pull request to the merge queue Nov 25, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to Branch Protection failures Nov 25, 2026
You're not authorized to push to this branch. Visit "About protected branches" for more information.
@llucax
llucax added this pull request to the merge queue Nov 26, 2026
@llucax
llucax removed this pull request from the merge queue due to a manual request Nov 26, 2026
@llucax
llucax added this pull request to the merge queue Nov 26, 2026
Merged via the queue into frequenz-floss:v2.x.x with commit 0a760cc Nov 26, 2026
9 checks passed
@llucax
llucax deleted the merge-v1.13.1-into-v2 branch November 26, 2026 08:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

part:docs Affects the documentation part:tests Affects the unit, integration and performance (benchmarks) tests part:utilities Affects the utility receivers (`Timer`, `Event`, `FileWatcher`)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MonotonicTimer.ready() can swallow its own cancellation

2 participants