-
Notifications
You must be signed in to change notification settings - Fork 517
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
Self-hosted agent on M2 hangs when building MAUI on NET6 / NET7 / NET8 #19547
Comments
It's a bummer the attempted fix didn't work... I'll try to figure out what's going on, but it may take a while. Can you start by trying to run |
@rolfbjarne I tried the command |
Can you try using lldb instead then:
|
When I run those commands on the build agent, it kills the build. Here's the outputs:
Azure Devops OutputEnvocTemplate.AppDevTemplate.Maui -> /Users/Shared/Agents/Agent2/_work/10/s/Mobile/src/Maui/bin/Release/net8.0-ios/ios-arm64/EnvocTemplate.AppDevTemplate.Maui.dll /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/bitcode_strip Optimizing assemblies for size may change the behavior of the app. Be sure to test after publishing. See: https://aka.ms/dotnet-illink Optimizing assemblies for size. This process might take a while. /Users/envocadmin/.nuget/packages/xamarin.firebase.ios.core/8.10.0.3/lib/net6.0-ios15.4/Firebase.Core.resources/GoogleUtilitiesComponents.xcframework/ios-arm64/GoogleUtilitiesComponents.framework/GoogleUtilitiesComponents : warning MT7091: The framework /Users/envocadmin/.nuget/packages/xamarin.firebase.ios.core/8.10.0.3/lib/net6.0-ios15.4/Firebase.Core.resources/GoogleUtilitiesComponents.xcframework/ios-arm64/GoogleUtilitiesComponents.framework is a framework of static libraries, and will not be copied to the app. [/Users/Shared/Agents/Agent2/_work/10/s/Mobile/src/Maui/EnvocTemplate.AppDevTemplate.Maui.csproj::TargetFramework=net8.0-ios] /Users/envocadmin/Library/Caches/XamarinBuildDownload/FAnlytcs-8.9.1/FirebaseAnalytics-8.9.1/Frameworks/FirebaseAnalytics.xcframework/ios-arm64_armv7/FirebaseAnalytics.framework/FirebaseAnalytics : warning MT7091: The framework /Users/envocadmin/Library/Caches/XamarinBuildDownload/FAnlytcs-8.9.1/FirebaseAnalytics-8.9.1/Frameworks/FirebaseAnalytics.xcframework/ios-arm64_armv7/FirebaseAnalytics.framework is a framework of static libraries, and will not be copied to the app. [/Users/Shared/Agents/Agent2/_work/10/s/Mobile/src/Maui/EnvocTemplate.AppDevTemplate.Maui.csproj::TargetFramework=net8.0-ios] /Users/envocadmin/Library/Caches/XamarinBuildDownload/GAppM-8.9.1/GoogleAppMeasurement-8.9.1/Frameworks/GoogleAppMeasurement.xcframework/ios-arm64_armv7/GoogleAppMeasurement.framework/GoogleAppMeasurement : warning MT7091: The framework /Users/envocadmin/Library/Caches/XamarinBuildDownload/GAppM-8.9.1/GoogleAppMeasurement-8.9.1/Frameworks/GoogleAppMeasurement.xcframework/ios-arm64_armv7/GoogleAppMeasurement.framework is a framework of static libraries, and will not be copied to the app. [/Users/Shared/Agents/Agent2/_work/10/s/Mobile/src/Maui/EnvocTemplate.AppDevTemplate.Maui.csproj::TargetFramework=net8.0-ios] assertion failed [_is_handling_requests && _is_suspended]: thread is unexpectedly in the runtime. arm_pc=0x7ff7ffc7d4fc arm_lr=0x7ff7ffc8f1c4 saved_lr=0x7ff89effac2c (ThreadContextRegisterState.cpp:390 guest_gpr_state_from_host_state) /Users/Shared/Agents/Agent2/_work/_temp/a3cc7759-f218-468e-ba53-7185874aeaeb.sh: line 1: 3595 Killed: 9 dotnet publish 'Mobile/src/Maui/EnvocTemplate.AppDevTemplate.Maui.csproj' -f net8.0-ios --self-contained -r ios-arm64 -c Release -p:BuildIpa=True -p:ApplicationId=com.envoctemplate.appdevtemplate.qa /p:ApplicationVersion=61713 /p:ApplicationDisplayVersion=0.1.3 /p:ApplicationTitle='QA' ##[error]Bash exited with code '137'. Finishing: Publish iOS |
Next try, once the hang happens again:
@akoeplinger @filipnavara any other ideas how to diagnose this? |
Here's the file |
Ok, that shows numerous interesting stack traces, it seems the runtime has deadlocked, there are several mutexes that seem stuck:
although the latter might be due to
Smaller sample text file with redundant frames removed: |
On a different note, I noticed it's the x64 version of dotnet that's being used:
I'm not sure if it's possible to change this in your CI to use the arm64 version instead to see if that fixes the issue? |
Here is my dotnet info on the machine:
Is there any command that I can run to see which architecture is installed? Part of the tasks in the pipeline are to install dotnet and maui workloads. Here's the task:
From what I can see, the Agent has folders |
Well it looks like this is an existing issue: microsoft/azure-pipelines-tasks#19174. If this really is the cause, it would explain why doing a build locally on the machine works but not in the agent. |
Running these commands in the pipeline, returned the following results:
|
Maybe it's possible to force it to use the system .NET by setting the PATH environment variable before running
|
I ran multiple runs alternating commenting out the install dotnet task, and the ones that were commented out all ran successfully. I assume if you don't specify a version it uses what's installed on the machine (which I manually installed as arm64). It looks like my workaround is to not install dotnet on self-hosted builds. I'm not sure if fixing running the wrong architecture of dotnet on a M2 causes the ios build to freeze is a priority or not. Thank you for your help in figuring out what the issue is. I'll let you decide if you want to close this or not. |
The deadlock in dotnet could be a bug in dotnet (or maybe even Rosetta), so I'm moving this to dotnet/runtime. |
This issue was moved to dotnet/runtime#95704 |
Steps to Reproduce
Expected Behavior
Build should finish
Actual Behavior
Build hangs with no output until it times out
Environment
Let me know if I can email you diagnostic logs or the link to the build definition. I'd prefer not to post the whole logs here.
Versions
Agent version: 3.230.0
macOS: 13.6
.NET: 8.0.100
Microsoft.Maui.Sdk: 8.0.3
Microsoft.iOS.Sdk: 17.0.8478
Build Logs
Example Project (If Possible)
Previously following #17825 but can't update it since I'm not a collaborator. Also related microsoft/azure-pipelines-agent#4205
This has been an issue on NET 6 & NET 7. I just upgraded to NET 8 since it released and the above bug has been fixed, however I still have the issue.
Kicking off a dotnet publish for a NET 8 Maui ios app, hangs forever. Opening a terminal on the mac, pasting the exact line, and executing it in the agent's folder, runs fine.
Filed corresponding bug in Pipelines Agent: microsoft/azure-pipelines-agent#4546
@rolfbjarne I don't think your fix for limiting the parallelization of the CPU fixed the issue for me.
Debug output gave near identical output like this for the last 45+ minutes:
ADO Output
##[debug]Agent running environment resource - Disk: available:627050.00MB out of 948584.00MB, Memory: used 27MB out of 65536MB, CPU: usage 0.02
##[debug]Agent running environment resource - Disk: available:627050.00MB out of 948584.00MB, Memory: used 27MB out of 65536MB, CPU: usage 0.02
##[debug]Agent running environment resource - Disk: available:627050.00MB out of 948584.00MB, Memory: used 27MB out of 65536MB, CPU: usage 0.02
##[debug]Agent running environment resource - Disk: available:627050.00MB out of 948584.00MB, Memory: used 27MB out of 65536MB, CPU: usage 0.02
##[debug]Agent running environment resource - Disk: available:627050.00MB out of 948584.00MB, Memory: used 27MB out of 65536MB, CPU: usage 0.02
##[debug]Agent running environment resource - Disk: available:627050.00MB out of 948584.00MB, Memory: used 27MB out of 65536MB, CPU: usage 0.02
##[debug]Agent running environment resource - Disk: available:627050.00MB out of 948584.00MB, Memory: used 27MB out of 65536MB, CPU: usage 0.02
##[debug]Agent running environment resource - Disk: available:627050.00MB out of 948584.00MB, Memory: used 27MB out of 65536MB, CPU: usage 0.02
##[debug]Agent running environment resource - Disk: available:627050.00MB out of 948584.00MB, Memory: used 27MB out of 65536MB, CPU: usage 0.02
##[debug]Agent running environment resource - Disk: available:627050.00MB out of 948584.00MB, Memory: used 27MB out of 65536MB, CPU: usage 0.02
##[debug]Agent running environment resource - Disk: available:627050.00MB out of 948584.00MB, Memory: used 27MB out of 65536MB, CPU: usage 0.02
##[debug]Agent running environment resource - Disk: available:627050.00MB out of 948584.00MB, Memory: used 27MB out of 65536MB, CPU: usage 0.02
##[debug]Agent running environment resource - Disk: available:627050.00MB out of 948584.00MB, Memory: used 27MB out of 65536MB, CPU: usage 0.02
##[debug]Agent running environment resource - Disk: available:627050.00MB out of 948584.00MB, Memory: used 27MB out of 65536MB, CPU: usage 0.02
##[debug]Agent running environment resource - Disk: available:627050.00MB out of 948584.00MB, Memory: used 27MB out of 65536MB, CPU: usage 0.02
##[debug]Agent running environment resource - Disk: available:627050.00MB out of 948584.00MB, Memory: used 27MB out of 65536MB, CPU: usage 0.02
##[debug]Agent running environment resource - Disk: available:627050.00MB out of 948584.00MB, Memory: used 27MB out of 65536MB, CPU: usage 0.02
##[debug]Agent running environment resource - Disk: available:627050.00MB out of 948584.00MB, Memory: used 27MB out of 65536MB, CPU: usage 0.02
##[debug]Agent running environment resource - Disk: available:627050.00MB out of 948584.00MB, Memory: used 27MB out of 65536MB, CPU: usage 0.02
##[debug]Agent running environment resource - Disk: available:627050.00MB out of 948584.00MB, Memory: used 27MB out of 65536MB, CPU: usage 0.02
##[debug]Starting diagnostic file upload.
##[debug]Setting up diagnostic log folders.
##[debug]Creating diagnostic log files folder.
##[debug]Creating diagnostic log environment file.
The text was updated successfully, but these errors were encountered: