Skip to content

andrew-kulikov/runtime-samples

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

runtime-samples

Playground for .net runtime

1. Mono AOT hang

A critical deadlock occurs in Mono AOT runtime when processing assemblies with a large number of classes (>65,000). The issue causes application hangs on both Android and iOS platforms using .NET 9 with AOT compilation.

The issue was introduced by PR #85952, which added an "optimization" to prevent failures when an AOT assembly contains more than 65,000 classes. When this threshold is exceeded, the AOT compiler produces a name table of size 0.

In the runtime code at aot-runtime.c:2711-2712, when the name table size is 0, the code path returns early without calling amodule_unlock. This causes the AOT module lock to be held indefinitely, leading to deadlocks when other threads attempt to access the same module.

Steps to reproduce:
1.

cd ./maui-aot-hang
  1. Generate 65000 types in MauiAotHang.Features lib:
python ./generate_classes.py -o ./MauiAotHang.Features/sample.cs simple -n 65000
  1. Publish app with mono AOT (for example for Android x64 emulator on windows)
dotnet publish ./MauiAotHang/MauiAotHang.csproj -f net9.0-android -r android-x64
  1. Install and run app

About

Playground for .net runtime

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published