Skip to content

Correct library docs: skipping api.shutdown() no longer hangs - #549

Open
sibson wants to merge 1 commit into
mainfrom
docs/255-reactor-threads-daemon
Open

sibson wants to merge 1 commit into
mainfrom
docs/255-reactor-threads-daemon

Conversation

@sibson

@sibson sibson commented Oct 9, 2026

Copy link
Copy Markdown
Owner

docs/library.md said skipping api.shutdown() hangs the process at exit. Not true since 1.4.0 (#379): the thread pool starts from the daemon reactor thread, so its workers are daemons. The warning becomes a note keeping shutdown() as the clean teardown. Also fixes the VM example's client.connect → api.connect and adds api.shutdown(), and corrects the same claim in a test_api_lifecycle.py comment.

Tested outside CI: the #255 reporter's script exits rc=0 on main and hangs only with #379's change reverted.

Refs #255, #273

🤖 Generated with Claude Code

docs/library.md warned that the reactor's worker threads are non-daemon,
so an application that skips api.shutdown() never exits. That stopped
being true in 1.4.0: afbc4a5 (#379) dispatches connect setup through
reactor.callFromThread, so the thread pool is started from the daemon
reactor thread and its workers inherit daemon status. The reporter's
script from #255 exits rc=0 on main and hangs only with that one line
reverted. The warning becomes a note: shutdown() is still the clean
teardown, and the reason the context manager doesn't call it (a
reactor cannot be restarted) stays.

The VM example called client.connect(), which does not exist, and
ended without api.shutdown(). The tearDownModule comment in
test_api_lifecycle.py repeated the non-daemon claim; it now states
the constraint that actually makes the call once-per-process.

Smaller option: delete the warning outright. Rejected because readers
on <1.4.0 still hit the hang and the shutdown()/with-block relationship
is not obvious from the API.

Refs #255, #273

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
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.

1 participant