Skip to content

Cancel the eventlet Timer's entry so repeating timers stop - #11161

Open
AliMuhammadAslam wants to merge 1 commit into
celery:mainfrom
AliMuhammadAslam:fix/eventlet-timer-cancel
Open

AliMuhammadAslam wants to merge 1 commit into
celery:mainfrom
AliMuhammadAslam:fix/eventlet-timer-cancel

Conversation

@AliMuhammadAslam

@AliMuhammadAslam AliMuhammadAslam commented Nov 24, 2026 •

Copy link
Copy Markdown

Description

Fixes #11160

GreenThread.cancel() does nothing once the greenthread has started, so a timer from call_repeatedly() could not be cancelled after its first tick: the entry was never marked canceled and kept rescheduling itself. clear() had the same problem while a callback was running, and an entry canceled with entry.cancel() still ran. In a worker, every broker reconnect left another Heart/Gossip timer running.

The timer's greenthreads now cancel their entry when they are cancelled, and canceled entries are skipped when they come due.

The new tests run against the real eventlet hub. 6 of them fail on main. Note that CI only installs eventlet on Python < 3.10, so they are skipped on newer versions.

GreenThread.cancel() is a no-op once the greenthread has started, so
cancelling a repeating timer after its first tick left the entry
running. Mark the entry canceled on cancel() and skip canceled entries.
@AliMuhammadAslam
AliMuhammadAslam force-pushed the fix/eventlet-timer-cancel branch from b1409a0 to f1dbc57 Compare November 24, 2026 12:15

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

eventlet Timer: cancelling a repeating timer does not stop it

1 participant