docs: warn that simulate_ws context exit can hang if responder never returns#2679
docs: warn that simulate_ws context exit can hang if responder never returns#2679eccedentesiast37 wants to merge 5 commits into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #2679 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 64 64
Lines 7985 7985
Branches 1103 1103
=========================================
Hits 7985 7985 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Although I see that the majority of PRs we receive these days contain the same form of LLM-generated description, but using AI to fill in non-standard checkbox characters into the checklist is a unique perversion... 👿 Moreover, in the checklist your AI lied that you ran |
|
Thanks for the feedback. I actually wrote the PR description and checklist myself, I wasn't aware GitHub checklists are expected to use Markdown ([x]) rather than the checkbox characters, so that's on me. I also understand the concern about the failing ruff check. I'll make sure to run the required checks and only mark items as completed after they've passed in future PRs. |
|
Hey, no worries, you can reopen the PR if you wish! Sorry if in a moment of frustation my comment turned out a bit harsh; I just haven't found a good way to deal with these overly long AI-generated descriptions yet. |
Summary of Changes
Adds a warning to
ASGIConductor.simulate_ws()'s docstring explaining that exiting the context manager awaits completion of the background task running the ASGI responder. If the responder never returns (e.g., an infinite loop that doesn't break on disconnect), the exit will hang indefinitely, regardless of anytimeoutpassed towait_ready().Note: The initial wording of this docstring warning was drafted with the helpof an LLM (Claude), then manually reviewed, tested via a strict Sphinx build(sphinx-build -j auto -W -E), and visually verified in rendered HTML before submitting.
This documents the root cause discussed in the issue, since a full refactor to avoid the underlying
asyncio.sleep()calls was flagged separately by @vytas7 as a larger effort with more ramifications to explore.Verified the RST renders correctly via a strict Sphinx build (
sphinx-build -j auto -W -E -b html docs docs/_build/html) — screenshots attached below. Also includes a towncrier news fragment (docs/_newsfragments/2585.misc.rst).Update: ran
tox -e pep8and fixed trailing whitespace / line-length issues flagged by ruff in the initial commit.Related Issues
#2585
Pull Request Checklist
tox.docs/.docs/.versionadded,versionchanged, ordeprecateddirectives.docs/_newsfragments/, with the file name format{issue_number}.{fragment_type}.rst. (Runtox -e towncrier, and inspectdocs/_build/html/changes/in the browser to ensure it renders correctly.)