Skip to content

Remove macOS Socket.Select workaround that caused Cleanup() to hang#1142

Open
follesoe wants to merge 1 commit intozeromq:masterfrom
follesoe:fix/macos-poller-hang
Open

Remove macOS Socket.Select workaround that caused Cleanup() to hang#1142
follesoe wants to merge 1 commit intozeromq:masterfrom
follesoe:fix/macos-poller-hang

Conversation

@follesoe
Copy link
Copy Markdown

Summary

  • Removes the macOS-specific Socket.Select workaround in Poller.cs that split the call into two separate invocations (one for readList, one for errorList)
  • The second call blocked forever with infinite timeout, preventing the Reaper from processing Stop commands, causing Cleanup() to hang indefinitely
  • The underlying .NET runtime bug (dotnet/corefx#39617) was reported in 2019 and fixed in .NET 9 (2024), but the Cleanup hang indicates the workaround never worked as intended

See #1040 (comment) for a detailed root cause analysis.

Fixes #1040

Test plan

  • Verified build succeeds on all target frameworks (net8.0, net472, netstandard2.1)
  • Verified on macOS (Apple Silicon) with .NET 10 that Cleanup(block: false) no longer hangs

🤖 Generated with Claude Code

The macOS workaround split Socket.Select into two separate calls (one
for readList, one for errorList). When the timeout was infinite (-1),
the second call blocked forever waiting for an error condition that
never occurred, preventing the Reaper from processing Stop commands
and causing Cleanup() to hang indefinitely.

The underlying .NET runtime bug (dotnet/corefx#39617) was reported in
2019 and fixed in .NET 9 (2024). However, the Cleanup hang indicates
the workaround never worked as intended. Now that the underlying issue
is also resolved on broadly available .NET versions for macOS and iOS,
the workaround can be safely removed.

Fixes zeromq#1040

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.

NetMQConfig.Cleanup() hangs forever even after dispose

1 participant