Skip to content

Fix crash on Linux when testing the archive plugin#641

Open
sebsto wants to merge 1 commit intomainfrom
sebsto/fix_plugin
Open

Fix crash on Linux when testing the archive plugin#641
sebsto wants to merge 1 commit intomainfrom
sebsto/fix_plugin

Conversation

@sebsto
Copy link
Collaborator

@sebsto sebsto commented Feb 12, 2026

Fix a rare crash in CI on the archive plugin.

The crash is a race condition in PluginUtils.swift's execute method. The code set a terminationHandler on the Process that called readToEnd() on the pipe, while simultaneously the readabilityHandler could still be firing on the same pipe's file handle. On Linux (x86_64, Ubuntu 24.04 in CI), this race corrupts memory during Swift runtime metadata resolution (swift_conformsToProtocol, _swift_getGenericMetadata), which manifests as the SIGSEGV we're seeing in _dispatch_event_loop_drain.

The fix:

I removed the terminationHandler entirely. Since waitUntilExit() is already called synchronously, we know the process is done.
After waitUntilExit(), we set readabilityHandler = nil to stop the async reads, then do one final readToEnd() on the output queue to drain any remaining data.
This eliminates the race between the readability handler and the termination handler competing over the same file handle.

@sebsto sebsto self-assigned this Feb 12, 2026
@sebsto sebsto added the 🔨 semver/patch No public API change. label Feb 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🔨 semver/patch No public API change.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant