Include _run_once duration in asyncio debug
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 5/5
- Geschätzter Aufwand
- Über eine Woche
- Anfängerfreundlichkeit
- 25/100
Rechercherichtung
Beginne in Lib/asyncio/base_events.py bei der im Issue referenzierten bestehenden Protokollierung der Dauer langsamer Callbacks und prüfe anschließend, wie _run_once behandelt wird. Das Issue stellt drei mögliche Designs vor. Kläre daher zuerst, welches Verhalten implementiert werden soll und welcher Schwellenwert sowie welche diagnostische Ausgabe erwartet werden. Als abgeschlossen gilt die Vereinbarung über eine Laufzeitdauerdiagnose für Ereignisschleifen im Debug-Modus mit entsprechender Testabdeckung.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
Feature or enhancement
In asyncio debug mode, log the duration of the asyncio iteration if it exceeds the slow_callback_duration (or a separate duration), as is done now for individual coroutine durations.
Pitch
This will capture when one eventloop iteration is slow, not just because one coroutine is blocking for a while, but because there might be several smaller tasks to process (e.g. 10 10ms operations in one tick blocks incoming operations just as much as one 100ms task, but nothing is logged, currently). It might be less actionable info if it doesn’t log the tasks, but it’s proved useful to us in the past as a more general diagnostic with other event loops (pre-asyncio tornado.IOLoop.set_blocking_log_threshold). This may be an indicator that a web worker is overloaded and more replicas are needed, for example, even if each individual task is handled quickly.
I see three possible versions of this:
- like slow coroutines, log only a single time for
_run_onceif it exceeds a threshold. This doesn't contain actionable info on its own other than 'things are slow' - add to 1. some summary information about the tasks (e.g. log total number and top N coroutines and durations if the sum of durations exceeds some threshold)
- replicate tornado's pre-asyncio set_blocking_log_threshold, which logs the stack when the time is crossed via
signal.setitimer. The nice thing about this is it can diagnose hangs, not just slowness, unlike after-complete timer logs. Only available wheresetitimeris also available, of course.
Previous discussion
Brought up originally on async-sig.
- Vorherrschende Sprache
- Python
- Sterne
- 77.2k
- Forks
- 36k
- Ø Merge
- 1 T. 9 Std.
- Gemergte PRs (30 T.)
- 558
Beitragsleitfaden
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus python/cpython
-
docs pending
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
-
stdlib type-feature
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
-
stdlib type-feature
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
-
build type-bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 76/100
-
stdlib topic-email type-feature
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 70/100
Ähnliche Issues
-
area/auth bug comp/agent P3 platform/discord type/security
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 88/100
NousResearch/hermes-agent#117848 ·
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 74/100
bancolombia/sentinel#23 ·
-
test md OffenCI
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 74/100
-
integration:quickjs org:external priority:backlog topic:code-interpreter topic:middleware type:feature
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 74/100
langchain-ai/deepagents#6450 ·
-
bug client
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 88/100