Skip to content

Fix more crashes in archive#642

Open
sebsto wants to merge 2 commits intomainfrom
sebsto/fix_archive_crash
Open

Fix more crashes in archive#642
sebsto wants to merge 2 commits intomainfrom
sebsto/fix_archive_crash

Conversation

@sebsto
Copy link
Collaborator

@sebsto sebsto commented Feb 16, 2026

Issue

Related to intermittent CI crashes with Signal 11 (SIGSEGV) during swift package archive on Linux x86_64 (Ubuntu 24.04)

Description of the changes

Replaces FileHandle.readabilityHandler with a manual blocking read loop using availableData on a serial DispatchQueue in the Utils.execute method of the AWSLambdaPackager plugin.

On Linux, FileHandle.readabilityHandler's setter internally calls _bridgeAnythingToObjectiveC, which triggers swift_dynamicCast / swift_conformsToProtocol. When the Swift runtime is concurrently resolving type metadata on other threads, this causes a bad pointer dereference crash in _dispatch_event_loop_drain. The new approach uses a while loop calling availableData (blocks until data arrives, returns empty Data at EOF), completely avoiding the problematic Foundation/ObjC bridging code paths.

New/existing dependencies impact assessment, if applicable

No new dependencies were added to this change.

Conventional Commits

fix: replace FileHandle.readabilityHandler with manual read loop in AWSLambdaPackager plugin

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@sebsto sebsto self-assigned this Feb 16, 2026
@sebsto sebsto added the 🔨 semver/patch No public API change. label Feb 16, 2026
@sebsto sebsto requested a review from Copilot February 16, 2026 11:46
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request addresses intermittent CI crashes (SIGSEGV) during swift package archive on Linux by replacing FileHandle.readabilityHandler with a manual blocking read loop. The crashes were caused by the readability handler's setter triggering Objective-C bridging code that conflicts with concurrent Swift runtime metadata resolution.

Changes:

  • Removed FileHandle.readabilityHandler usage which caused crashes due to _bridgeAnythingToObjectiveC / swift_dynamicCast calls
  • Implemented manual read loop using availableData in an async block to avoid problematic Foundation/ObjC bridging
  • Removed the post-process readToEnd() call as the new read loop handles all data

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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