Add detailed logging on AsyncProcess to help diagnose hangs #9275
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation:
See #9274 for context.
The existing logging is insufficient to diagnose hangs in AsyncProcess, so adding more detailed logging around process start, output, and termination should help identify where things are going wrong.
Modifications:
SWIFTPM_DEBUG_PROCESS_IOenvironment variable to enable low-level I/O thread debugging without interfering with normal observability outputprocessTrackingID(8-character UUID prefix) to uniquely identify each process instance in logs for correlation across multiple concurrent processeslogProcessIODebug()helper that writes directly to stderr when debug mode is enabled, bypassing all handlers to capture issues even when the observability system has problemsResult:
After this change, AsyncProcess will log detailed information about process lifecycle events, including when processes are started, when output is received, and when processes terminate. This should provide better visibility into where hangs may be occurring during dependency resolution.
Users experiencing hangs can now run: