-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
iOS: crash when profiling dotnet-podcasts #71492
Comments
Tagging subscribers to this area: @tommcdon Issue DetailsDescriptionThe dotnet-podcasts app crashes on an iOS device when profiling. Reproduction StepsClone https://github.com/microsoft/dotnet-podcasts [optional] Apply this to not have to install android bits: https://gist.github.com/rolfbjarne/c4a5514cb3e0445f8e32cc03ea624d3d Read/Follow the instructions here to profile on device: https://github.com/xamarin/xamarin-macios/wiki/Profiling: Clone dotnet/diagnostics and patch dotnet-dsrouter with this PR: dotnet/diagnostics#3134 Run dotnet-dsrouter from dotnet/diagnostics: $ cd src/Tools/dotnet-dsrouter
$ dotnet run -- server-client -ipcs ~/my-dev-port -tcpc 127.0.0.1:9001 --forward-port iOS
[leave this running] Build & run the dotnet-podcasts app: dotnet build /p:RuntimeIdentifier=ios-arm64 *.csproj /bl /p:MtouchNoSymbolStrip=true
DEVNAME=00008110-000568491A92801E
mlaunch --installdev bin/Debug/net6.0-ios/ios-arm64/Microsoft.NetConf2021.Maui.app --devname $DEVNAME
mlaunch --launchdev bin/Debug/net6.0-ios/ios-arm64/Microsoft.NetConf2021.Maui.app --devname $DEVNAME --wait-for-exit --wait-for-unlock --argument --connection-mode --argument none '--setenv:DOTNET_DiagnosticPorts=127.0.0.1:9001,suspend,listen' Wait until the app prints this:
Then start diagnosing: $ dotnet-trace collect --diagnostic-port ~/my-dev-port,connect --format speedscope
No profile or providers specified, defaulting to trace profile 'cpu-sampling'
Provider Name Keywords Level Enabled By
Microsoft-DotNETCore-SampleProfiler 0x0000F00000000000 Informational(4) --profile
Microsoft-Windows-DotNETRuntime 0x00000014C14FCCBD Informational(4) --profile
Process : my-dev-port
Output File : /Users/rolf/work/microsoft/dotnet-podcasts/src/my-dev-port_20220630_164525.nettrace
[00:00:04:41] Recording trace 457.052 (KB)
Press <Enter> or <Ctrl+C> to exit... The app will now crash. Output when using lldb: https://gist.github.com/rolfbjarne/0683b315020aef560b3790a4af01435e Expected behaviorNo crash Actual behaviorCrash Regression?No response Known WorkaroundsNo response ConfigurationNo response Other informationBinlog: msbuild.binlog.zip
|
Tagging subscribers to 'os-ios': @steveisok, @akoeplinger Issue DetailsDescriptionThe dotnet-podcasts app crashes on an iOS device when profiling. Reproduction StepsClone https://github.com/microsoft/dotnet-podcasts [optional] Apply this to not have to install android bits: https://gist.github.com/rolfbjarne/c4a5514cb3e0445f8e32cc03ea624d3d Read/Follow the instructions here to profile on device: https://github.com/xamarin/xamarin-macios/wiki/Profiling: Clone dotnet/diagnostics and patch dotnet-dsrouter with this PR: dotnet/diagnostics#3134 Run dotnet-dsrouter from dotnet/diagnostics: $ cd src/Tools/dotnet-dsrouter
$ dotnet run -- server-client -ipcs ~/my-dev-port -tcpc 127.0.0.1:9001 --forward-port iOS
[leave this running] Build & run the dotnet-podcasts app: dotnet build /p:RuntimeIdentifier=ios-arm64 *.csproj /bl /p:MtouchNoSymbolStrip=true
DEVNAME=00008110-000568491A92801E
mlaunch --installdev bin/Debug/net6.0-ios/ios-arm64/Microsoft.NetConf2021.Maui.app --devname $DEVNAME
mlaunch --launchdev bin/Debug/net6.0-ios/ios-arm64/Microsoft.NetConf2021.Maui.app --devname $DEVNAME --wait-for-exit --wait-for-unlock --argument --connection-mode --argument none '--setenv:DOTNET_DiagnosticPorts=127.0.0.1:9001,suspend,listen' Wait until the app prints this:
Then start diagnosing: $ dotnet-trace collect --diagnostic-port ~/my-dev-port,connect --format speedscope
No profile or providers specified, defaulting to trace profile 'cpu-sampling'
Provider Name Keywords Level Enabled By
Microsoft-DotNETCore-SampleProfiler 0x0000F00000000000 Informational(4) --profile
Microsoft-Windows-DotNETRuntime 0x00000014C14FCCBD Informational(4) --profile
Process : my-dev-port
Output File : /Users/rolf/work/microsoft/dotnet-podcasts/src/my-dev-port_20220630_164525.nettrace
[00:00:04:41] Recording trace 457.052 (KB)
Press <Enter> or <Ctrl+C> to exit... The app will now crash. Output when using lldb: https://gist.github.com/rolfbjarne/0683b315020aef560b3790a4af01435e Expected behaviorNo crash Actual behaviorCrash:
Regression?No response Known WorkaroundsNo response ConfigurationNo response Other informationBinlog: msbuild.binlog.zip
|
Happens when we get a thrown exception with a NULL exceptions message from profiler into EventPipe. This issue has been fixed in .net7, 0e35b8d. It is possible to disable exception events to be generated as a workaround, remove 0x8000 from: Microsoft-Windows-DotNETRuntime 0x00000014C14FCCBD provider giving it a mask of 0x00000014C14F4CBD instead, that should not trigger exception events anymore. It might be worth considering a backport of 0e35b8d to .net6. Have not seen this in the past on any other platform, and I know that MAUI team have been profiling the PodCast app on Android quite extensively, so is probably a failure on iOS, maybe in relationship with full AOT (since its device). Thanks for reporting with all details, it really helped locating the issue by just investigate the callstack and assembly dump info. |
@rolfbjarne Do you have ability to rebuild runtime with 0e35b8d and verify that it resolves the issue in .net6? |
If it does resolve in .NET 6, we should backport 0e35b8d |
@steveisok @lateralusX how can I build the runtime and get runtime packs for iOS?
|
For iOS, just build like this './build.sh -Subset mono+libs+packs -os iOS -arch arm64' |
Yes, this resolves the crash. |
Already fixed in .net7 and pending backport for .net6, #72002. |
Description
The dotnet-podcasts app crashes on an iOS device when profiling.
Reproduction Steps
Clone https://github.com/microsoft/dotnet-podcasts
[optional] Apply this to not have to install android bits: https://gist.github.com/rolfbjarne/c4a5514cb3e0445f8e32cc03ea624d3d
Read/Follow the instructions here to profile on device: https://github.com/xamarin/xamarin-macios/wiki/Profiling:
Clone dotnet/diagnostics and patch dotnet-dsrouter with this PR: dotnet/diagnostics#3134
Run dotnet-dsrouter from dotnet/diagnostics:
Build & run the dotnet-podcasts app:
Wait until the app prints this:
Then start diagnosing:
The app will now crash.
Output when using lldb: https://gist.github.com/rolfbjarne/0683b315020aef560b3790a4af01435e
Expected behavior
No crash
Actual behavior
Crash:
Regression?
No response
Known Workarounds
Disable capturing the exception runtime events:
dotnet-trace collect --diagnostic-port ~/my-dev-port,connect --providers Microsoft-Windows-DotNETRuntime:0x00000014C14F4CBD:4,Microsoft-DotNETCore-SampleProfiler:0x0000F00000000000:4 --format speedscope
Configuration
No response
Other information
Binlog: msbuild.binlog.zip
The text was updated successfully, but these errors were encountered: