-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
[net6][iOS] Ran out of trampolines of type 1
running on x64 simulator
#68808
Comments
From @rolfbjarne on Fri, 29 Apr 2022 15:19:55 GMT We're going to need a way to reproduce this, would it be possible to get access to your project? |
From @msftbot[bot] on Fri, 29 Apr 2022 15:20:13 GMT Hi @jeromelaban. We have added the "need-info" label to this issue, which indicates that we have an open question for you before we can take further action. This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time. |
From @jeromelaban on Fri, 29 Apr 2022 15:22:39 GMT Yes, it's this one, from this commit: unoplatform/Uno.Gallery@233b06d. You'll need to build |
From @jeromelaban on Fri, 29 Apr 2022 15:26:55 GMT One additional information I discovered, if I disable the interpreter, the application runs properly. The hint was in the stack trace:
|
From @rolfbjarne on Tue, 03 May 2022 11:52:04 GMT I can reproduce, here's a crash report: https://gist.github.com/rolfbjarne/8038c203eec8a33fc580bee41866d75b I believe this is because:
runtime/src/mono/mono/mini/aot-runtime.c Lines 2278 to 2283 in c73386b
runtime/src/mono/mono/mini/aot-runtime.c Line 5858 in c73386b
runtime/src/mono/mono/mini/aot-runtime.c Line 5860 in c73386b
runtime/src/mono/mono/mini/aot-runtime.c Lines 5770 to 5771 in c73386b
The current workaround is to disable the interpreter. I'm moving to dotnet/runtime, since I believe that's where the issue is. |
Is the x64 ios simulator config running in aot-only mode ? |
The infinite trampoline stuff is not implemented on x64, so either we need to increase the default number of rgctx trampolines we emit into the corlib aot image, or enable the user to set it. |
@rolfbjarne maybe setting the defaults higher when you aot would be the way to go? |
Would this be possible? What could be the timeline be (.NET 7?)?
Yes, we can either allow the user to increment these values (I didn't know we didn't have infinite trampolines on all our platforms, so it's currently not possible to increment the number of trampolines manually), or set a higher default (or do both). That said, the final fix is to implement infinite trampolines. |
I've filed xamarin/xamarin-macios#14887 so we can look at this in the meantime. |
The infinite trampoline code might conflict with future apple security measures, so adding it could lead to problems in the future. The question is why is this configuration which rans on a JIT capable system is using aot trampolines in the first place. |
Looks like we have a MONO_AOT_MODE_INTERP and a MONO_AOT_MODE_INTERP_ONLY configuration, the former is based on full aot so it will try to use aot trampolines, the latter doesn't. |
This mode was introduced primarily to get interp mode working on arm64 where JIT fallback isn't realistic. /cc @lambdageek |
@rolfbjarne Would it be possible to use MONO_AOT_MODE_INTERP_ONLY instead MONO_AOT_MODE_INTERP on x64 ?
We might need to modify the ios x64 simulator runtimes to not disable the jit. |
We need FullAOT trampolines for the interpreter on arm64 because apple doesn't allow JITing on the M1 hardware. For the x64 Simulator we FullAOT the interpreter trampolines mostly because we can just have a single configuration for both M1 and x64.
Do you mean on the M1 or x64? I doubt Apple would introduce additional security measures on x64 that are not already present on the M1. And if they did decide to lock down x64, I think JITing would be disallowed before page remapping. |
I can certainly try and see if it works (I'm assuming it can work without too much effort, since it did work at some point), but the question (which I can't really answer) is: do we want to do that, or implement infinite trampolines on x86_64? |
My vote: I would rather run the same configuration on both x64 and arm64. |
It didn't, it aborts with:
|
Not sure what is happening here, MONO_AOT_MODE_INTERP_ONLY is the same as running with --interp. |
Maybe there is a mismatch in the headers, this is the definition of MonoAotMode: |
That was the issue, once I fixed the value, using Now we just need to decide whether that's what we want to do :) |
Implementing infinite trampolines is a lot of work, so I'd prefer this approach. |
Closing as I believe |
… for x86_64. The 'MONO_AOT_MODE_INTERP' mode is based on full AOT, which requires infinite trampoline code to not potentially run out of trampolines. However, that mode isn't implemented for x86_64, so in that case use 'MONO_AOT_MODE_INTERP_ONLY', which will use the JIT as a fallback. Ref: dotnet/runtime#68808 Fixes: xamarin#14887
… for x86_64. (#15429) The 'MONO_AOT_MODE_INTERP' mode is based on full AOT, which requires infinite trampoline code to not potentially run out of trampolines. However, that mode isn't implemented for x86_64, so in that case use 'MONO_AOT_MODE_INTERP_ONLY', which will use the JIT as a fallback. Ref: dotnet/runtime#68808 Fixes: #14887
I have the same issue when run maui on ios. ERR Info:
|
After updating dotnet sdk 6.0.400 this issue still exist,is there an update ? |
@SimenCTan The fix didn't make it to 6.0.400, and right now it's slated for the .NET 7 release later this fall. Unfortunately the only workaround at the moment is to disable the interpreter. |
thx, The temporary solution is add |
From @jeromelaban on Fri, 29 Apr 2022 15:13:56 GMT
Steps to Reproduce
Expected Behavior
The app runs without failing.
Actual Behavior
Environment
.NET 6 Mobile RC2
Build Logs
On demand.
Other details
Note that this does not reproduce on a physical device.
It tried changing this:
But since the AOT compiler does not seem to run in this context, it's likely not using these parameters.
Related: #53033
Copied from original issue xamarin/xamarin-macios#14855
The text was updated successfully, but these errors were encountered: