-
Notifications
You must be signed in to change notification settings - Fork 4k
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
MSBuildWorkspace.OpenSolutionAsync hangs indefinitely on 4.9.0+ in Windows 2022 Azure CI/CD #75967
Comments
Per conversation on discord, @dibarbet you said you will try to take a look. Please contact me or let me know how I can help. I haven't had time to set up another azure pipelines just for a minimal reproducible snippet, sorry. |
Been taking a look at this and nothing obvious is standing out. Can you try the following: Update the code to pass in the progress parameter to public static async Task<IEnumerable<Project>> GetProjectsAsync(string solutionPath)
{
...
var solution = await workspace.OpenSolutionAsync(solutionPath, progress: new Progress());
...
}
private class Progress : IProgress<ProjectLoadProgress>
{
public void Report(ProjectLoadProgress value)
{
Console.WriteLine($"{value.Operation} completed for {value.FilePath} ({value.TargetFramework}) in {value.ElapsedTime.TotalMilliseconds}ms");
}
} That should write logs similar to
Beyond that I think we'll have to get a hang dump (probably via procdump) |
I also wasn't able to get a minimal repro. For example I created this dotnet tool that loads a solution successfully on windows-2022 github action images - https://github.com/dibarbet/MSBuildWorkspaceConsole/actions/runs/11923292319/job/33231361423 Based on this link - https://learn.microsoft.com/en-us/azure/devops/pipelines/agents/hosted?view=azure-devops&tabs=yaml , the github image should be the same as the azure devops one. I would guess something related to the specific solution or environment being setup is causing an issue, though not sure what that would be. |
I'll do this and see what happens. Regarding a procdump, if you have steps I can throw together for the CI/CD to do that, let me know. Note that with no change to code or solution that is opened, v4.8.0 worked fine. EDIT: With the progress change, here is the run: |
So the run shows:
Contrast to locally (or other CI/CD runs like github actions with linux/macos):
|
@kamronbatman interesting note here - I took your .NET9 PR and ran it against github actions - appeared to have no issues there |
Good to know, thanks. I stopped using GitHub actions because it wasn't part of the unlimited actions for public repos. There was also another issue in the past but I don't remember what it was. |
@kamronbatman try something similar to this - dibarbet/ModernUO@202ae64 You may have to tweak it a bit to make sure it captures the dump on hang and uploads correctly. It is incredibly mystifying that the github actions run passes, but fails on AzDo with the exact same image. |
@dibarbet - The tool never exits, so can we put a 5minutes timer on the proc dump PS1 and kill the process? Otherwise I don't see how this would work. 🤔 PR Changes for the azure run:
EDIT: I added messages, and it never gets past running the schema generator. We might need to tweak the ps1 so it's non-blocking? |
@kamronbatman procdump should collect a hang dump after the process doesn't respond for 5 seconds. IIRC it should also exit after that (and we only wait on the procdump process exiting). Either procdump doesn't actually exit after it collects a dump or procdump isn't detecting a hang. How we fix it depends on which one is happening. I've adjusted the script so it should live write the process output to the console, instead of waiting until the end. This should help us tell if procdump is collecting anything or not - dibarbet/ModernUO@52a27e1 |
|
Thanks - it looks like procdump isn't detecting a hang and not collecting any dumps. Try this instead - it will collect a dump every 5 seconds up to 5 total. You may have to adjust the time depending on how long it takes to get to the broken state - dibarbet/ModernUO@14ea3c6 |
@dibarbet I sent you a link to the dumps via discord. |
Unfortunately hit another snag that I didn't realize beforehand - the processId from launching the dotnet tool is unfortunately only a wrapper around another process that is actually running the tool. And there are additionally a further couple of processes involved in the MSBuildWorkspace project loading. The previous dumps only captured the wrapper process which doesn't have anything really useful in it. Procdump is definitely not very ergonomic to use for this case, but unfortunately I don't think there's anything better 😆 . |
Thanks @dibarbet, I sent you the dumps. |
Version Used:
Steps to Reproduce:
Expected Behavior:
The code should move past OpenSolutionAsync, returning the workspace and finish running the application.
Actual Behavior:
Specifically on Azure Pipelines, latest Windows 2022, with .NET 9:
The code above hangs indefinitely.
Link to the PR in our repo that replicates this:
https://github.com/modernuo/SerializationGenerator/pull/43/files#diff-f2b522070e7bfd744704829ee17ae88ea259383f12f3a45fb2d860a2a0c3e19c
In that PR, I also tried to clean up any possible deadlocks, but nothing changed.
Repo that uses this tool and it's PR:
https://github.com/modernuo/ModernUO/pull/1984/files#diff-7afd3bcf0d0c06d6f87c451ef06b321beef770ece4299b3230bb280470ada2f6
The azure pipelines yaml file we use is here:
https://github.com/modernuo/ModernUO/pull/1984/files#diff-7915b9b726a397ae7ba6af7b9703633d21c031ebf21682f3ee7e6a4ec52837a5
The tool is run through a cmd file as part of the build process:
https://github.com/modernuo/ModernUO/blob/1d08572926ad3e6376fbebb1ec169624f9cfdb74/publish.cmd#L46
I cannot replicate this locally on Windows 11, nor on other operating systems. If I had to guess, it is related to how .NET is installed/path'd on that docker
The text was updated successfully, but these errors were encountered: