Uh oh!
There was an error while loading. Please reload this page.
ApplyStartupHook diagnostic IPC command - #86813
Conversation
ghost
commented
May 26, 2023
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
|
jander-msft
commented
May 26, 2023
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 |
Uh oh!
There was an error while loading. Please reload this page.
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 |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
jkotas
commented
May 31, 2023
Test failures: |
vitek-karas
left a comment
There was a problem hiding this comment.
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.
Uh oh!
There was an error while loading. Please reload this page.
jander-msft
commented
Jun 1, 2023
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. |
jander-msft
commented
Jun 7, 2023
/azp run runtime |
|
Commenter does not have sufficient privileges for PR 86813 in repo dotnet/runtime |
davmason
commented
Jun 7, 2023
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. |
davmason
commented
Jun 7, 2023
/azp run runtime |
|
Azure Pipelines successfully started running 1 pipeline(s). |
davmason
commented
Jun 8, 2023
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 |
jander-msft
commented
Jun 8, 2023
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. |
jander-msft
commented
Jun 8, 2023
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? |
davmason
commented
Jun 8, 2023
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. |
jander-msft
commented
Jun 8, 2023
It's the same port. |
jander-msft
commented
Jun 8, 2023
/azp run runtime |
|
Commenter does not have sufficient privileges for PR 86813 in repo dotnet/runtime |
jander-msft
commented
Jun 8, 2023
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. |
jander-msft
commented
Jun 8, 2023
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. |
jkotas
commented
Jun 9, 2023
/azp run runtime |
|
Azure Pipelines successfully started running 1 pipeline(s). |
jander-msft
commented
Jun 9, 2023
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. |
davmason
commented
Jun 12, 2023
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. |
vitek-karas
commented
Jun 13, 2023
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_HOOKSapp 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