You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
.NET 7 - Segmentation Fault on BeagleBone Black (arm32) #78657
I'm getting a Segmentation Fault after installing .NET 7.0 SDK (v7.0.100) - Linux Arm32 on a BeagleBone Black running Debian 10.4. I tried both an existing upgrade from 6.0, as well as a fresh SD card image.
Running just the dotnet command works fine, but any other command (even dotnet --version) results in a segmentation fault.
debian@beaglebone:~$ dotnet
Usage: dotnet [options]
Usage: dotnet [path-to-application]
Options:
-h|--help Display help.
--info Display .NET information.
--list-sdks Display the installed SDKs.
--list-runtimes Display the installed runtimes.
path-to-application:
The path to an application .dll file to execute.
debian@beaglebone:~$ dotnet --version
Segmentation fault
Running strace dotnet --version the command seems to output properly (however I am not a strace expert by any means but I am seeing a proper "write" command in the output):
@dotnet/dotnet-diag I'm failing at getting managed stacks from the dump. Can someone tell me what I'm missing?
I'm running a docker container with linux arm32 and getting this:
(lldb) sosstatus
Target OS: LINUX Architecture: Arm ProcessId: 6323 (0x18B3)
#0 .NET Core runtime at 00000000B677F000 size 0046E2B9 index ad7c731feb7243bba7f5fa9b0f931444aaad01e0
Runtime module path: /home/issues/libcoreclr.so
Runtime module directory: /home/issues
DAC: /home/issues/libmscordaccore.so
Current symbol store settings:
-> Cache: /root/.dotnet/symbolcache
-> Server: https://msdl.microsoft.com/download/symbols/ Timeout: 4 RetryCount: 0
GC memory usage for managed SOS components: 628,552 bytes
(lldb) clrstack
Failed to load data access module, 0x80004002
Can not load or initialize libmscordaccore.so. The target runtime may not be initialized.
For more information see https://go.microsoft.com/fwlink/?linkid=2135652
ClrStack failed
I think that dump might not be complete or doesn't contain managed info. I'm not expert on this, but I had problems with core dumps some time ago (also on arm32 ).
It usually means:
disk space issue - did you have enough space on partition where you made dump?
limit set to dump - maybe something like ulimit -S -c unlimited will help - not to limit dumps
correct flags - to include all info including managed - I use echo 0xff > /proc/<PID>/coredump_filter in systemd for my process
https://github.com/orgs/dotnet/teams/dotnet-diag I'm failing at getting managed stacks from the dump. Can someone tell me what I'm missing?
I think that dump might not be complete or doesn't contain managed info. I'm not expert on this, but I had problems with core dumps some time ago (also on arm32 ).
Hi @elinor-fung and @michaldobrodenka! It does indeed look like the dump is incomplete. For more details on crash dump generation see here. I suggest collecting a full dump by setting DOTNET_DbgMiniDumpType=4. Hope this helps!
I will add that by chance I happened to run the dotnet --version command again after generating the dump and it worked, but executing the command again resulted in a segmentation fault. So this issue does seem to be inconsistent in generating a fault all the time.
Using IL Spy I see the last two frames have md tokens that are Microsoft.DotNet.Cli.Program.Main -> Microsoft.DotNet.Cli.Program.ProcessArgs. They are both r2r, but the disassembly is also odd for ARM. (The oddity was LLDB failint to detect it was thumbv2 assembly). Maybe running with DOTNET_ReadyToRun=0 might help?
Some good and bad news to report. The issue still happens with SDK 8.0.100-preview.1.
However, running commands with DOTNET_ReadyToRun=0 as recommended by @hoyosjs results in the dotnet command running properly. This is true for both .NET 7 and 8.
I was able to run dotnet --versiondotnet new console and dotnet run without issues.
Ran into new issues sadly, Am able to run projects normally by launching w/ dotnet program.dll (.NET 7 and 8) but get a segmentation fault when running from a service. systemctl start program (works fine w/ .NET 6)
Just putting it out there in case anyone finds a way around it.
Tried putting DOTNET_ReadyToRun=0 in /etc/environment but no go.
I'm not positive this is related, but I've been running into an issue with a .net7 published application running on BBB with behavior that sounds extremely similar (inconsistent segfaults). For what it's worth, the application appears to run fine if I turn off address randomization for the process (setarch -R ./program).
I recompiled under .net6 with the only change being some datetime microseconds references (that aren't supported) and the application runs correctly every time. Unfortunately that native high-precision timing support is necessary for my application.
A couple more datapoints:
Running with strace (but without setarch -R), it does not seem to segfault at all.
I have observed instances where the application does partially run, segfaulting after the first 1-2 log entries, and on a couple rare occasions it runs fine indefinitely.
I can't prove it, but it almost seems like it's more likely to reach execution of application code as the system gets loaded down. This smells like some kind of use-after-free race condition with maybe garbage collection(?)
Any update to this? Will this be fixed in a future release?
We ran into this after upgrading our application from .net 6 to 8, took a while to figure out that the problem was not in our code. At least the workaround mentioned by @outlookhazy seems to work for now (disabling ASLR)...
Activity
marcpopMSFT commentedon Nov 21, 2022
Routing to runtime as a likely issue in the runtime or host itself.
elinor-fung commentedon Nov 22, 2022
@Limb Would it be possible for you to get/share a core dump of the crash?
Limb commentedon Nov 22, 2022
@elinor-fung Hopefully I created the core dump successfully, please see core
elinor-fung commentedon Nov 23, 2022
Seems to be in
Microsoft.TemplateEngine.Cli.dll:@dotnet/dotnet-diag I'm failing at getting managed stacks from the dump. Can someone tell me what I'm missing?
I'm running a docker container with linux arm32 and getting this:
michaldobrodenka commentedon Nov 23, 2022
I think that dump might not be complete or doesn't contain managed info. I'm not expert on this, but I had problems with core dumps some time ago (also on arm32 ).
It usually means:
ulimit -S -c unlimitedwill help - not to limit dumpsecho 0xff > /proc/<PID>/coredump_filterin systemd for my processbut i may be wrong :)
tommcdon commentedon Nov 23, 2022
Hi @elinor-fung and @michaldobrodenka! It does indeed look like the dump is incomplete. For more details on crash dump generation see here. I suggest collecting a full dump by setting
DOTNET_DbgMiniDumpType=4. Hope this helps!elinor-fung commentedon Nov 23, 2022
Thanks, @michaldobrodenka and @tommcdon.
@Limb could you try collecting a full dump per #78657 (comment)?
Limb commentedon Nov 28, 2022
@elinor-fung here is the core dump using
DOTNET_DbgMiniDumpType=4Limb commentedon Nov 28, 2022
I will add that by chance I happened to run the
dotnet --versioncommand again after generating the dump and it worked, but executing the command again resulted in a segmentation fault. So this issue does seem to be inconsistent in generating a fault all the time.4 remaining items
hoyosjs commentedon Dec 17, 2022
Using IL Spy I see the last two frames have md tokens that are
Microsoft.DotNet.Cli.Program.Main->Microsoft.DotNet.Cli.Program.ProcessArgs.They are both r2r, but the disassembly is also odd for ARM.(The oddity was LLDB failint to detect it was thumbv2 assembly). Maybe running withDOTNET_ReadyToRun=0might help?The assembly right before the call is:
with fixups it's
The assembly doesn't explain the next frames in the stack though, so not sure I am interpreting this quite right.
JustSuperHuman commentedon Mar 10, 2023
I'm wondering if anyone has an update on this. Does it happen w/ the .NET 8 beta?
hoyosjs commentedon Mar 10, 2023
I don't think anyone is actively working on this. I am not sure anything has changed here.
Limb commentedon Mar 11, 2023
Limb commentedon Mar 13, 2023
Some good and bad news to report. The issue still happens with SDK 8.0.100-preview.1.
However, running commands with
DOTNET_ReadyToRun=0as recommended by @hoyosjs results in the dotnet command running properly. This is true for both .NET 7 and 8.I was able to run
dotnet --versiondotnet new consoleanddotnet runwithout issues.JustSuperHuman commentedon Mar 13, 2023
Ty for testing @Limb - Weird enough I'm testing now w/ 7.0.200 and it seems to be working without adding the ReadyToRun flag 🤔
JustSuperHuman commentedon Mar 13, 2023
Ran into new issues sadly, Am able to run projects normally by launching w/
dotnet program.dll(.NET 7 and 8) but get a segmentation fault when running from a service.systemctl start program(works fine w/ .NET 6)Just putting it out there in case anyone finds a way around it.
Tried putting
DOTNET_ReadyToRun=0in /etc/environment but no go.outlookhazy commentedon Jul 26, 2023
I'm not positive this is related, but I've been running into an issue with a .net7 published application running on BBB with behavior that sounds extremely similar (inconsistent segfaults). For what it's worth, the application appears to run fine if I turn off address randomization for the process (setarch -R ./program).
I recompiled under .net6 with the only change being some datetime microseconds references (that aren't supported) and the application runs correctly every time. Unfortunately that native high-precision timing support is necessary for my application.
A couple more datapoints:
I can't prove it, but it almost seems like it's more likely to reach execution of application code as the system gets loaded down. This smells like some kind of use-after-free race condition with maybe garbage collection(?)
bklop commentedon Jan 10, 2024
Any update to this? Will this be fixed in a future release?
We ran into this after upgrading our application from .net 6 to 8, took a while to figure out that the problem was not in our code. At least the workaround mentioned by @outlookhazy seems to work for now (disabling ASLR)...
Blackclaws commentedon Sep 30, 2024
So we're still seeing this issue on the current net 8.0 the workaround with DOTNET_ReadyToRun=0 seems to work but this should get fixed somehow.
michaldobrodenka commentedon Oct 1, 2024
This issue fit into pattern mentioned here #102396 (comment)
Still a small sample, but maybe there is a problem with older ARMv7 cores. Beaglebone black has ARM A8. Maybe it's connected to VFPv3 vs VFPv4