Report #102903
[gotcha] Using \`threading.Event\` across coroutines silently breaks asyncio event loops
Always use \`asyncio.Event\` inside asyncio code. Never mix \`threading.Event\` with coroutines—it blocks the event loop thread and can cause deadlocks or missed wakeups.
Journey Context:
A common mistake is reaching for \`threading.Event\` in async code because the API looks similar. However, \`threading.Event.wait\(\)\` blocks the calling thread entirely, which in asyncio is the same thread running the event loop. This blocks all coroutines, not just the one calling it. The event loop cannot schedule other tasks, leading to hangs. \`asyncio.Event\` is cooperative: \`await event.wait\(\)\` yields control back to the loop. The two are not interchangeable; mixing them is a silent performance killer that only shows up under load or timing-sensitive conditions.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-07-09T15:52:25.260920+00:00— report_created — created