Skip to content
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

Ensure exception event source listener is running before applying startup hook #7342

Merged
merged 8 commits into from
Sep 23, 2024

Conversation

schmittjoseph
Copy link
Member

@schmittjoseph schmittjoseph commented Sep 19, 2024

Summary

Ensure that the exception event source listener pipeline is running before applying the startup hook / resuming the process. This is to prevent an issue where some early exception data events could be missed if there are sent before the event source listener pipeline is ready. This can result in the name-cache being out-of-sync and thus the reported call stacks missing information such as mvids.

To fix this, we need to update DiagnosticLifetimeBackgroundService to support waiting on services to fully start before returning from StartAsync.

Note

This doesn't address the issue when attaching to a non-suspended .NET process that has been explicitly configured to run our startup hook via the DOTNET_STARTUP_HOOKS environment variable. Solving for this specific case will require additional work and is outside of the scope of this PR.

Release Notes Entry

Fixed an issue that could sometimes result in exceptions having incomplete stack information reported in exception history.

@schmittjoseph schmittjoseph added the update-release-notes Pull requests that should be mentioned in the release notes label Sep 19, 2024
@schmittjoseph schmittjoseph requested a review from a team as a code owner September 19, 2024 20:53
wiktork
wiktork previously approved these changes Sep 20, 2024
jander-msft
jander-msft previously approved these changes Sep 23, 2024
@schmittjoseph schmittjoseph merged commit c8e57f5 into dotnet:main Sep 23, 2024
26 checks passed
@schmittjoseph schmittjoseph deleted the wait-for-exception-listener branch September 23, 2024 20:18
@schmittjoseph
Copy link
Member Author

/backport to release/8.0

Copy link
Contributor

Started backporting to release/8.0: https://github.com/dotnet/dotnet-monitor/actions/runs/11001765218

Copy link
Contributor

@schmittjoseph backporting to release/8.0 failed, the patch most likely resulted in conflicts.

Please backport manually using one of the below commands, followed by git am --continue once the merge conflict has been resolved.

PowerShell

(Invoke-WebRequest "https://github.com/dotnet/dotnet-monitor/commit/c8e57f5ab11d8ab7640d52f456db57e3294fdb85.patch").Content | git am --3way --ignore-whitespace --exclude="documentation/**.md" --keep-non-patch

Bash

curl -sSL "https://github.com/dotnet/dotnet-monitor/commit/c8e57f5ab11d8ab7640d52f456db57e3294fdb85.patch" | git am --3way --ignore-whitespace --exclude="documentation/**.md" --keep-non-patch

git am error output:

$ git am --3way --ignore-whitespace --exclude="documentation/**.md" --keep-non-patch changes.patch

Applying: Ensure exception event source listener is running before applying startup hook (#7342)
.git/rebase-apply/patch:21: trailing whitespace.
                // 
warning: 1 line adds whitespace errors.
Using index info to reconstruct a base tree...
M	src/Tools/dotnet-monitor/Commands/CollectCommandHandler.cs
M	src/Tools/dotnet-monitor/DiagnosticLifetimeBackgroundService.cs
M	src/Tools/dotnet-monitor/Exceptions/ExceptionsService.cs
Falling back to patching base and 3-way merge...
Auto-merging src/Tools/dotnet-monitor/Exceptions/ExceptionsService.cs
CONFLICT (content): Merge conflict in src/Tools/dotnet-monitor/Exceptions/ExceptionsService.cs
CONFLICT (modify/delete): src/Tools/dotnet-monitor/DiagnosticLifetimeBackgroundService.cs deleted in Ensure exception event source listener is running before applying startup hook (#7342) and modified in HEAD. Version HEAD of src/Tools/dotnet-monitor/DiagnosticLifetimeBackgroundService.cs left in tree.
Auto-merging src/Tools/dotnet-monitor/Commands/CollectCommandHandler.cs
CONFLICT (content): Merge conflict in src/Tools/dotnet-monitor/Commands/CollectCommandHandler.cs
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
hint: When you have resolved this problem, run "git am --continue".
hint: If you prefer to skip this patch, run "git am --skip" instead.
hint: To restore the original branch and stop patching, run "git am --abort".
hint: Disable this message with "git config advice.mergeConflict false"
Patch failed at 0001 Ensure exception event source listener is running before applying startup hook (#7342)
Error: The process '/usr/bin/git' failed with exit code 128

schmittjoseph added a commit to schmittjoseph/dotnet-monitor that referenced this pull request Oct 2, 2024
wiktork pushed a commit that referenced this pull request Oct 2, 2024
…e applying startup hook (#7395)

* Ensure exception event source listener is running before applying startup hook (#7342)

* Fix merge
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
update-release-notes Pull requests that should be mentioned in the release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants