Repository navigation
fix(profiling): cover alternate asyncio task creation - #19422
Closed
taegyunkim wants to merge 1 commit into
Closed
taegyunkim wants to merge 1 commit into
taegyunkim wants to merge 1 commit into
Conversation
Codeowners resolved as |
Circular import analysis
|
Contributor
|
taegyunkim
force-pushed
the
taegyunkim/profiling-asyncio-span-inheritance
branch
from
July 30, 2026 22:08
02909e3 to
8dfd99e
Compare
taegyunkim
force-pushed
the
taegyunkim/profiling-asyncio-creation-paths
branch
from
July 30, 2026 22:09
4585594 to
df4912d
Compare
Contributor
Author
|
Consolidated into #19346 so the asyncio attribution change can be reviewed and landed as one complete lifecycle unit. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Stacked on #19421, following the core asyncio task attribution in #19346.
Covers asyncio task and loop execution paths that can bypass
BaseEventLoop.create_task()or event-loop policy registration.The change:
ensure_futurepaths, including the helper used by supported Python versions ofgather();TaskGroup.create_task();asyncio.create_task()path;BaseEventLoopfor the duration ofrun_forever(), coveringrun_until_complete()andRunner(loop_factory=...)loops that were never installed throughset_event_loop();finally, so stopped loops are not retained or later unwound from the wrong thread.Duplicate publication through nested standard-library helpers is safe and idempotent. The task mapping is simply updated with the same copied metadata, and weak finalizer registration is deduplicated by task ID.
A task created entirely inside third-party native code can still be unobserved. Such a task remains unattributed and never falls back to the event-loop thread link.
Testing
Added regressions for:
asyncio.gather();new_event_loop().run_until_complete()without callingset_event_loop().Python 3.13 uvloop environment:
Also passed
scripts/lint,git diff --check, and targeted formatting.scripts/run-benchmarks --listfound no benchmark suite matching_asyncio.py.Risks
run_forever()adds two loop-registration calls per invocation, not per event-loop iteration.Additional Notes
No separate release note is needed because this extends the customer-facing asyncio fix documented in #19346. Add the
changelog/no-changeloglabel.