FULL AI ANALYSIS

Python async tasks remain pending when service shuts down

Generated Sep 20, 2026, 11:55:04 PM

Analysis summary

The reported behaviour is consistent with the event loop closes before consumers finish cancellation and acknowledgement cleanup. The safest next step is to verify that hypothesis with a reversible test before making permanent configuration changes.

Possible causes

The event loop closes before consumers finish cancellation and acknowledgement cleanup.

76%

A recent software, firmware or configuration change is exposing an existing compatibility issue.

28%

Suggested fixes

1

Verify the likely cause

Stop accepting work, cancel consumers, await gathered tasks with return_exceptions and close the connection before ending the loop.

2

Validate and monitor

Reproduce the issue once after the change, review relevant logs or metrics, and keep a rollback path until the system has remained stable.