-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
ApplyStartupHook diagnostic IPC command #86813
Conversation
Tagging subscribers to this area: @tommcdon Issue DetailsThese changes allow adding diagnostic startup hooks through a new diagnostic IPC command. The new command has a single string property on it that represents the path to the assembly on disk that contains the startup hook. The diagnostic startup hooks are stored in a separate host property called There are currently no added/updated tests as I'm first looking for validation of the concept and feedback on the initial implementation; once settled, I can invest more time in adding tests. Partially addresses #83756 cc @dotnet/dotnet-monitor
|
cc @vitek-karas and @elinor-fung: wanted your feedback on where this new property should be get/set from the diagnostic command (currently, it's going through the host runtime contract), and how to compose that (and maybe the other host properties) with the list of properties that were passed into |
ILLink suppression needs to be updated to remove the trim warnings: https://github.com/dotnet/runtime/blob/main/src/libraries/System.Private.CoreLib/src/ILLink/ILLink.Suppressions.LibraryBuild.xml#L22 |
src/coreclr/System.Private.CoreLib/src/System/StartupHookProvider.CoreCLR.cs
Outdated
Show resolved
Hide resolved
Test failures:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should really try to add some test for this new capability. Hopefully we already have some test infra somewhere to help with the setup of the diag channel.
There seems to be event pipe tests located here; I don't think any of them involve loading an assembly separate from the entrypoint assembly, so there may be additional work for enabling that compilation and locating of that assembly in the test output. I can also add some variants of the existing tests here for the managed side. |
/azp run runtime |
Commenter does not have sufficient privileges for PR 86813 in repo dotnet/runtime |
I need a little bit to investigate, I don't know off the top of my head. I will let you know later today if it's expected or not. |
/azp run runtime |
Azure Pipelines successfully started running 1 pipeline(s). |
I have done some research and the behavior of the ResumeRuntime command is by design. We keep track of each port's suspend status (so you can suspend for multiple sessions) and then pause startup until all ports that requested a suspend have marked themselves as resumed. So if you have a reverse server port and then connect to the default diagnostic port to send ResumeRuntime, it will mark the default diagnostic port as resumed but keep suspended because the reverse server port is still waiting for its ResumeRuntime. These two functions are the interesting ones, if anyone wants to dig through code: runtime/src/native/eventpipe/ds-server.c Lines 259 to 285 in 7c00b17
|
That wasn't the issue though; the hang problem was occurring from:
This commit fixed the test that shows changing from using the default connection for the ApplyStartupHook to using the reverse connection stream makes it work. |
It looks like the test legs that are cancelling due to timeouts are because the Helix runs are taking a lot longer than they normally should. I've looked an some of those and all of the work items eventually complete, just longer than the timeout for the AzDO job (which is 2.5 hrs). For example:
The other reported test failures seem to be unrelated to these changes. Any guidance on what's the path forward from here? |
In step 4 do you accept on the same port as step 1 or a different port? If it's the same port I am thinking to not bother with fixing it. It isn't the best behavior but since we expect to get the ResumeRuntime command on the same connection as the ReverseServer I don't think we need to spend a lot of effort making sure we fail the right way when we receive the command on a different port. |
It's the same port. |
/azp run runtime |
Commenter does not have sufficient privileges for PR 86813 in repo dotnet/runtime |
I keep forgetting I can't kick off new builds for this repo, can someone kick one off again for me? Trying to get a fresh PR build merge point and hoping to get through the backed up Helix queues. |
I was hoping to get a new build (not a rerun of the existing build) in order to see if the chrome-DebuggerTests and the build failure on freebsd could be avoided. |
/azp run runtime |
Azure Pipelines successfully started running 1 pipeline(s). |
Finally have a build that didn't time out. I logged a know build issue (#87323) because the work items sent to the The Build Analysis seems to have attributed all of the failures to known issues. I would like to ask for approvals and this to be merged if there isn't any additional feedback. |
I'm happy with the current state, @elinor-fung, @lateralusX, or @vitek-karas if you want to take a further look let us know, otherwise I will merge it after end of day Monday. |
Thanks a lot Justin, especially for being patient with us to figure out the final design. |
These changes allow adding diagnostic startup hooks through a new diagnostic IPC command. The new command has a single string property on it that represents the path to the assembly on disk that contains the startup hook.
The diagnostic startup hooks are stored in a static variable and then passed to
StartupHookProvider.ManagedStartup
; here the list of hooks is combined with the ones from theSTARTUP_HOOKS
app context data and then processed as startup hooks normally would be processed. Tests for both the managed library changes and the event pipe have been added.I did not implement this in Mono; I did not see a way of dynamically providing startup hooks (e.g. such as environment variable) and didn't want to enable this dynamic notion without a scenario in place. I also have very little understanding on how to implement it for that runtime, so I've fixed it up enough that it would pass an empty string for the diagnostic startup hooks, thus preserving the existing behavior.
I did not implement this for AOT scenarios since adding startup hooks there doesn't make sense (no managed code execution).
Corresponding diagnostics change: dotnet/diagnostics#3918
Partially addresses #83756
cc @dotnet/dotnet-monitor