Skip to content

Conversation

@brandond
Copy link
Member

@brandond brandond commented Oct 28, 2025

Fixes error that has been reported on Slack a few times:

Oct 28 16:08:49 notice k3s: time="2025-10-28T16:08:49+01:00" level=error msg="TTL delete trigger failed for key=/registry/events/<podname>-59dd494c99-6zccx.18716e967027d1c1: context canceled, requeuing"

This happens when K3s or RKE2 use kine with TLS - kine is started up once without TLS to extract bootstrap data (the kine certs), and then stopped. Unfortunately the workqueue does not get the memo and keeps running with a cancelled context.

The for loop was only checking for context cancellation once, before going into an endless range on the event channel. Move the channel read into the select, so that the for loop actually runs more than once and checks for cancellation every iteration.

We should also shut down the workqueue if the event channel is closed, as this is another indicator of some problem that should halt processing.

On the processing side, don't reenqueue on context cancellation, as it will never succeed.

Also replaces workqueue.DelayingInterface with workqueue.TypedDelayingInterface[string] - the untyped version has been deprecated since 1.31, and the typed version saves us an assertion.

@brandond brandond requested a review from a team as a code owner October 28, 2025 16:56
The for loop was only checking for context cancellation once, before
going into an endless range on the event channel. Move the channel read
into the select, so that the for loop actually runs more than once and
checks for cancellation every iteration.

We should also shut down the workqueue if the event channel is closed,
as this is another indicator of some problem that should halt
processing.

On the processing side, don't reenqueue on context cancellation, as it
will never succeed.

Signed-off-by: Brad Davidson <[email protected]>
DelayingInterface has been deprecated since k8s v1.31

Signed-off-by: Brad Davidson <[email protected]>
@brandond brandond force-pushed the fix-ttl-context-cancel branch from e96d35e to f7636d9 Compare October 28, 2025 17:28
@brandond brandond merged commit 6ef70ce into k3s-io:master Oct 28, 2025
4 checks passed
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.

2 participants