Skip to content

Conversation

rintaro
Copy link
Member

@rintaro rintaro commented Oct 13, 2025

Cherry-pick #84829 into release/6.2

  • Explanation: When the compiler shuts down a plugin, it sends SIGTERM to the plugin process and then wait(2) to ensure it exits. However, we've observed cases where the compiler waits for the plugin process to terminate for an unexpectedly long time. This change introduces a special macro plugin message - an empty string - used as a signal for the plugin to shut down itself gracefully. The compiler now sends it before delivering SIGTERM, ensuring that even if the signal is not handled, the plugin still shuts down.
  • Scope: Macro plugins
  • Risk: Low, The change is simple and straightforward.
  • Testing: Updated the existing test cases. Manually tested with locally built toolchain and verified the issue is not reproduced with this change.
  • Issues: rdar://160820381
  • Reviewers: Hamish Knight

@rintaro rintaro requested a review from a team as a code owner October 13, 2025 03:34
@rintaro
Copy link
Member Author

rintaro commented Oct 13, 2025

swiftlang/swift-syntax#3166
@swift-ci Please test

When shutting down, the plugin, we send SIGTERM, then wait(2) on it. But
we observed some cases the compiler waits for the plugin process exit
for long time.

To resolve that, send an empty message to the plugin and let them exit
itself.

rdar://160820381
(cherry picked from commit a0b9b54)
@rintaro rintaro force-pushed the 6.2-plugin-termsignal-rdar160820381 branch from 19392f2 to f735928 Compare October 13, 2025 05:06
@rintaro
Copy link
Member Author

rintaro commented Oct 13, 2025

swiftlang/swift-syntax#3166
@swift-ci Please test

@rintaro
Copy link
Member Author

rintaro commented Oct 13, 2025

swiftlang/swift-syntax#3166
@swift-ci Please test Windows

@rintaro rintaro merged commit 13a49c9 into swiftlang:release/6.2 Oct 14, 2025
5 checks passed
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.

2 participants