Skip to content

docs: warn that simulate_ws context exit can hang if responder never returns#2679

Open
eccedentesiast37 wants to merge 5 commits into
falconry:masterfrom
eccedentesiast37:docs-websocket-test-hang
Open

docs: warn that simulate_ws context exit can hang if responder never returns#2679
eccedentesiast37 wants to merge 5 commits into
falconry:masterfrom
eccedentesiast37:docs-websocket-test-hang

Conversation

@eccedentesiast37

Copy link
Copy Markdown

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 any timeout passed to wait_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 pep8 and fixed trailing whitespace / line-length issues flagged by ruff in the initial commit.

Related Issues

#2585

Pull Request Checklist

  • [N/A] Applied changes to both WSGI and ASGI code paths and interfaces (where applicable).
  • [N/A] Added tests for changed code.
  • [✔] Performed automated tests and code quality checks by running tox.
  • [N/A] Prefixed code comments with GitHub nick and an appropriate prefix.
  • [✔] Coding style is consistent with the rest of the framework.
  • [✔] Updated documentation for changed code.
    • [N/A] Added docstrings for any new classes, functions, or modules.
    • [✔] Updated docstrings for any modifications to existing code.
    • [N/A] Updated both WSGI and ASGI docs (where applicable).
    • [N/A] Added references to new classes, functions, or modules to the relevant RST file under docs/.
    • [✔] Updated all relevant supporting documentation files under docs/.
    • [N/A] A copyright notice is included at the top of any new modules
    • [N/A] Changed/added classes/methods/functions have appropriate versionadded, versionchanged, or deprecated directives.
  • [✔] Changes (and possible deprecations) have towncrier news fragments under docs/_newsfragments/, with the file name format {issue_number}.{fragment_type}.rst. (Run tox -e towncrier, and inspect docs/_build/html/changes/ in the browser to ensure it renders correctly.)
  • [✔] LLM output, if any, has been carefully reviewed and tested by a human developer. (See also: Use of LLMs ("AI").)
falcon1 falcon2

@codecov

codecov Bot commented Jul 13, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (6a49881) to head (0e35f47).

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@vytas7

vytas7 commented Jul 13, 2026

Copy link
Copy Markdown
Member

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 tox, ruff is still failing.

@vytas7 vytas7 closed this Jul 13, 2026
@eccedentesiast37 eccedentesiast37 deleted the docs-websocket-test-hang branch July 13, 2026 17:44
@eccedentesiast37 eccedentesiast37 restored the docs-websocket-test-hang branch July 13, 2026 17:44
@eccedentesiast37 eccedentesiast37 deleted the docs-websocket-test-hang branch July 13, 2026 17:55
@eccedentesiast37

Copy link
Copy Markdown
Author

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.

@vytas7

vytas7 commented Jul 13, 2026

Copy link
Copy Markdown
Member

Hey, no worries, you can reopen the PR if you wish!
You are supposed to read and check the boxes in the UI , you don't need to write [x] or similar yourself.

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.

@eccedentesiast37 eccedentesiast37 restored the docs-websocket-test-hang branch July 13, 2026 18:21
@vytas7 vytas7 reopened this Jul 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants