Skip to content

[6.0][Runtime] Don't emit signposts until the system is ready. #73677

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 17, 2024

Conversation

mikeash
Copy link
Contributor

@mikeash mikeash commented May 16, 2024

Cherry-pick #73639 to release/6.0.

Emitting a signpost for the first time can trigger lazy setup of the logging system, and doing this in the wrong context can cause deadlocks. Check to see if the logging system is already set up, and only emit signposts if it has been to avoid triggering this.

As it's hard to determine if the "is it set up?" function is available in the SDK we're building against, only do this in OS builds, as it's not particularly useful in local builds.

rdar://124620772
(cherry picked from commit dd24d8e)

Emitting a signpost for the first time can trigger lazy setup of the logging system, and doing this in the wrong context can cause deadlocks. Check to see if the logging system is already set up, and only emit signposts if it has been to avoid triggering this.

As it's hard to determine if the "is it set up?" function is available in the SDK we're building against, only do this in OS builds, as it's not particularly useful in local builds.

rdar://124620772
(cherry picked from commit dd24d8e)
@mikeash mikeash requested a review from a team as a code owner May 16, 2024 18:33
@mikeash
Copy link
Contributor Author

mikeash commented May 16, 2024

@swift-ci please test

@mikeash
Copy link
Contributor Author

mikeash commented May 16, 2024

Explanation: We want to refrain from emitting signposts until the logging system is set up by something else, because triggering setup in certain contexts can lead to deadlocks.
Original PR: #73639
Reviewed by: @ktoso
Risk: Low. We make one additional call before emitting a signpost, and that call just checks an atomic global.
Resolves: rdar://124620772
Tests: This code runs extensively in pretty much all executable tests and when running programs normally. Tested manually to ensure that the new call gets made and behaves the way it's expected to.

@mikeash mikeash enabled auto-merge May 16, 2024 19:28
@mikeash mikeash merged commit f184f19 into swiftlang:release/6.0 May 17, 2024
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.

3 participants