Skip to content

When sourcekitd crashes, log the file contents with which it crashed and the request #933

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
Oct 31, 2023

Conversation

ahoppen
Copy link
Member

@ahoppen ahoppen commented Oct 26, 2023

This should make it a lot easier to reproduce sourcekitd crashes.

Copy link
Contributor

@bnbarham bnbarham left a comment

Choose a reason for hiding this comment

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

Should we log similar for clangd?

// FIXME: Ideally we could log the request key here at the info level but the dictionary is
// readonly.
logger.log(
logger.info(
Copy link
Contributor

Choose a reason for hiding this comment

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

What's default vs info? The docs weren't particularly illuminating.

Copy link
Member Author

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, so persisted vs not 👍

@ahoppen ahoppen changed the title When sourcekitd crashes, log the file contents with which it crashed and the request When sourcekitd crashes, log the file contents with which it crashed and the request 🚥 #932 Oct 27, 2023
@ahoppen ahoppen force-pushed the ahoppen/log-sourcekitd-crash-info branch from 6228f3d to fb3bc8c Compare October 27, 2023 16:52
@ahoppen ahoppen changed the title When sourcekitd crashes, log the file contents with which it crashed and the request 🚥 #932 When sourcekitd crashes, log the file contents with which it crashed and the request Oct 27, 2023
@ahoppen
Copy link
Member Author

ahoppen commented Oct 27, 2023

@swift-ci Please test

Comment on lines +112 to +109
for (index, chunk) in chunks.enumerated() {
logger.fault(
"""
sourcekitd crashed (\(index + 1)/\(chunks.count))
\(chunk)
"""
)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

If OSLog treats this as private (which I believe is the default?), will we just log multiple sourcekitd crashed lines with redacted chunks?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, we will. It’s a big unfortunate but I don’t have any better idea.

@ahoppen ahoppen force-pushed the ahoppen/log-sourcekitd-crash-info branch from fb3bc8c to def98da Compare October 30, 2023 21:05
@ahoppen
Copy link
Member Author

ahoppen commented Oct 30, 2023

@swift-ci Please test

@ahoppen ahoppen force-pushed the ahoppen/log-sourcekitd-crash-info branch from def98da to 4af0f71 Compare October 30, 2023 23:19
@ahoppen
Copy link
Member Author

ahoppen commented Oct 30, 2023

@swift-ci Please test

@ahoppen
Copy link
Member Author

ahoppen commented Oct 30, 2023

@swift-ci Please test Windows

1 similar comment
@ahoppen
Copy link
Member Author

ahoppen commented Oct 31, 2023

@swift-ci Please test Windows

…and the request

This should make it a lot easier to reproduce sourcekitd crashes.
@ahoppen ahoppen force-pushed the ahoppen/log-sourcekitd-crash-info branch from 4af0f71 to 1a23153 Compare October 31, 2023 15:31
@ahoppen
Copy link
Member Author

ahoppen commented Oct 31, 2023

@swift-ci Please test

@ahoppen
Copy link
Member Author

ahoppen commented Oct 31, 2023

@swift-ci Please test Windows

@ahoppen ahoppen merged commit 0c4f659 into swiftlang:main Oct 31, 2023
@ahoppen ahoppen deleted the ahoppen/log-sourcekitd-crash-info branch October 31, 2023 20:32
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