Skip to content

Fix channel close race and main_thread_only wedge after errors - #445

Open
RonnyPfannschmidt wants to merge 3 commits into
mainfrom
claude/project-thread-zlryhu
Open

RonnyPfannschmidt wants to merge 3 commits into
mainfrom
claude/project-thread-zlryhu

Conversation

@RonnyPfannschmidt

Copy link
Copy Markdown
Member

Requested by Ronny · project thread

🤖 Written by Claude Opus 5.5 via Claude Code for the execnet maintainers; I prompted it, it did the work, I read it.

Fixes #374: Channel.close() sent the close message before unregistering the channel id, so the peer could see the close while the id was still registered. On one CPU this made test_channel_passing_over_channel fail almost every run. The gw test fixture also cached gateways by transport only, so main_thread_only cases mostly ran on thread workers. Keying it by execmodel exposed a second bug: after a task raised, a main_thread_only worker rejected every later remote_exec as concurrent.


Generated by Claude Code

…ter errors

Channel.close() sent CHANNEL_CLOSE before removing the id from the
channel factory, so a peer could return from waitclose() and run its next
remote_exec while the old id was still registered. On a single CPU
test_channel_passing_over_channel hit this almost every run (#374).

With main_thread_only, executetask() returned early on an exception and
never set _executetask_complete, so every later remote_exec on that
worker was rejected as concurrent. Set it in a finally.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014GZsREmCGLBsihTm2x9zm3
The session group cached gateways by transport only, so e.g.
main_thread_only-popen reused whichever popen gateway was created first,
usually a thread worker, and main_thread_only was barely exercised.
Include the execmodel in the gateway id, reuse the shared sproxy1 and
proxy-transport gateways, and skip test_gateway_status_busy for
main_thread_only, which rejects concurrent remote_exec by design.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014GZsREmCGLBsihTm2x9zm3

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

non-deterministic test_channel test failure

2 participants