As per https://groups.google.com/g/golang-nuts/c/uL68-fxg2K4, this is a subtlety with finalizers (and cleanups) that doesn't really have any diagnostics. This issue proposes a new runtime/metrics metric to monitor when a finalizer or cleanup is likely to block the queue.

Taking a time measurement on each execution seems unfortunately expensive, but provided we're only trying to detect slow finalizers, it may be sufficient to take a sampling-based approach and expose a time histogram of finalizer (and cleanup) execution times.

Comment From: gopherbot

Change https://go.dev/cl/671437 mentions this issue: runtime: report finalizer and cleanup queue length with checkfinalizer>0

Comment From: gopherbot

Change https://go.dev/cl/690396 mentions this issue: runtime/metrics: add cleanup and finalizer queue metrics