Skip to content

[linux] Segfault while invoking Roslyn's csc.dll with long command line #98936

@grendello

Description

@grendello

The crash happens occasionally (every 4-5 builds) when building .NET Android's Mono.Android project, which passes a very long command line to the Roslyn C# compiler (1.8Mb long, over 11k parameters). It started happening with bump to the latest dotnet 9 preview, dotnet/installer/main@0a73f814e1 9.0.100-preview.2.24122.3.

Environment info:

OS: Debian/testing (trixie)
Arch: amd64
CPU: AMD Ryzen 9 5950X 16-Core Processor
Kernel: 6.7.6-x64v3-xanmod1

The crash doesn't happen on every build, but it appears the more parallel the build, the crashier the process becomes. It also appears that putting the long command line in a response file mitigates the issue, at least I wasn't able to reproduce the crash this way after 20 attempts. When the crash happens, runtime just goes away silently without capturing the signal and printing any information. Our CI Linux bot uses Ubuntu 20.04.6 LTS and, so far, doesn't appear to experience this crash (or we were lucky, as it only landed last Friday)

Unfortunately, to reproduce locally one would have to build Xamarin.Android on their machine and extract the csc invocation from binlog. This is necessary because the build uses a lot of artifacts produced by .NET Android build. I will be happy to provide assistance in that regard, if necessary :)

I extracted the compiler invocation into a shell script and captured a handful of coredumps, the best trace I managed to get is below:

* thread #1, name = 'dotnet', stop reason = signal SIGSEGV: address not mapped to object
  * frame #0: 0x00007f1f37e58384 libcoreclr.so`MethodTable::CheckRestore() [inlined] MethodTable::GetAuxiliaryData(this=0x0000000000000000) const at methodtable.h:2690:29 [opt]
    frame #1: 0x00007f1f37e58384 libcoreclr.so`MethodTable::CheckRestore() [inlined] MethodTable::IsFullyLoaded(this=0x0000000000000000) at methodtable.h:943:17 [opt]
    frame #2: 0x00007f1f37e58384 libcoreclr.so`MethodTable::CheckRestore(this=0x0000000000000000) at methodtable.cpp:4828:10 [opt]
    frame #3: 0x00007f1f37f324ef libcoreclr.so`JIT_Box(type=0x0000000000000000, unboxedData=<unavailable>) at jithelpers.cpp:2952:10 [opt]
    frame #4: 0x00007f1ec095f5b8
    frame #5: 0x00007f1eb8dceb12
    frame #6: 0x00007f1ebf7edde9
    frame #7: 0x00007f1ebe3c7879
    frame #8: 0x00007f1ebf7cfb66
    frame #9: 0x00007f1ebf7e15f6
    frame #10: 0x00007f1ebf7cb8f8
    frame #11: 0x00007f1ebf7caea2
    frame #12: 0x00007f1ebf7c9300
    frame #13: 0x00007f1ebf7c81e3
    frame #14: 0x00007f1ebf7c810e
    frame #15: 0x00007f1ebf7ca3b3
    frame #16: 0x00007f1ebf7c8db1
    frame #17: 0x00007f1ebf7c81e3
    frame #18: 0x00007f1ebf7c810e
    frame #19: 0x00007f1ebf7c7fbf
    frame #20: 0x00007f1ebf7c7921
    frame #21: 0x00007f1ebf7c2fce
    frame #22: 0x00007f1ebf7c0ef6
    frame #23: 0x00007f1ebd3558c3
    frame #24: 0x00007f1ebd354589
    frame #25: 0x00007f1ec09ce820
    frame #26: 0x00007f1ec09ce421
    frame #27: 0x00007f1ec099e1bb
    frame #28: 0x00007f1ec09a9fa4
    frame #29: 0x00007f1ec09a87f6
    frame #30: 0x00007f1ebf1fcb69
    frame #31: 0x00007f1ebf1de387
    frame #32: 0x00007f1ec09aedd6
    frame #33: 0x00007f1ec09a7e45
    frame #34: 0x00007f1ec09c1066
    frame #35: 0x00007f1ec09c5702
    frame #36: 0x00007f1ec09c0742
    frame #37: 0x00007f1ec09c04f2
    frame #38: 0x00007f1ec09c0078
    frame #39: 0x00007f1ec09bfc8e
    frame #40: 0x00007f1ec09bfb56
    frame #41: 0x00007f1ec09bd975
    frame #42: 0x00007f1eb9e856dd
    frame #43: 0x00007f1ebe4b8970
    frame #44: 0x00007f1ebe4b8640
    frame #45: 0x00007f1eb9e00752
    frame #46: 0x00007f1eb9e9e820
    frame #47: 0x00007f1ebe4b84d8
    frame #48: 0x00007f1ebe4b8450
    frame #49: 0x00007f1eb9e82458
    frame #50: 0x00007f1eb912d821
    frame #51: 0x00007f1ebe023091
    frame #52: 0x00007f1ebe020a24
    frame #53: 0x00007f1ebe46b422
    frame #54: 0x00007f1eb8eae5ab
    frame #55: 0x00007f1f380989a7 libcoreclr.so`CallDescrWorkerInternal at calldescrworkeramd64.S:97
    frame #56: 0x00007f1f37ed2cb6 libcoreclr.so`DispatchCallSimple(unsigned long*, unsigned int, unsigned long, unsigned int) [inlined] CallDescrWorkerWithHandler(pCallDescrData=0x00007edde5bffbc8, fCriticalCall=NO) at callhelpers.cpp:67:5 [opt]
    frame #57: 0x00007f1f37ed2c5e libcoreclr.so`DispatchCallSimple(pSrc=<unavailable>, numStackSlotsToCopy=<unavailable>, pTargetAddress=<unavailable>, dwDispatchCallSimpleFlags=0) at callhelpers.cpp:218:9 [opt]
    frame #58: 0x00007f1f37ee8692 libcoreclr.so`ThreadNative::KickOffThread_Worker(ptr=<unavailable>) at comsynchronizable.cpp:157:5 [opt]
    frame #59: 0x00007f1f37ea1a45 libcoreclr.so`ManagedThreadBase_DispatchOuter(ManagedThreadCallState*) [inlined] ManagedThreadBase_DispatchInner(pCallState=<unavailable>) at threads.cpp:7276:5 [opt]
    frame #60: 0x00007f1f37ea1a43 libcoreclr.so`ManagedThreadBase_DispatchOuter(ManagedThreadCallState*) [inlined] ManagedThreadBase_DispatchMiddle(pCallState=<unavailable>) at threads.cpp:7320:9 [opt]
    frame #61: 0x00007f1f37ea1a08 libcoreclr.so`ManagedThreadBase_DispatchOuter(ManagedThreadCallState*) [inlined] ManagedThreadBase_DispatchOuter(this=<unavailable>, pParam=<unavailable>)::$_0::operator()(ManagedThreadBase_DispatchOuter(ManagedThreadCallState*)::TryArgs*) const::'lambda'(Param*)::operator()(Param*) const at threads.cpp:7478:13 [opt]
    frame #62: 0x00007f1f37ea1a08 libcoreclr.so`ManagedThreadBase_DispatchOuter(ManagedThreadCallState*) [inlined] ManagedThreadBase_DispatchOuter(ManagedThreadCallState*)::$_0::operator()(this=<unavailable>, pArgs=<unavailable>) const at threads.cpp:7480:9 [opt]
    frame #63: 0x00007f1f37ea19e5 libcoreclr.so`ManagedThreadBase_DispatchOuter(pCallState=0x00007edde5bffda0) at threads.cpp:7504:5 [opt]
    frame #64: 0x00007f1f37ea200d libcoreclr.so`ManagedThreadBase::KickOff(void (*)(void*), void*) [inlined] ManagedThreadBase_FullTransition(pTarget=<unavailable>, args=<unavailable>, filterType=ManagedThread) at threads.cpp:7524:5 [opt]
    frame #65: 0x00007f1f37ea1ff5 libcoreclr.so`ManagedThreadBase::KickOff(pTarget=<unavailable>, args=<unavailable>) at threads.cpp:7559:5 [opt]
    frame #66: 0x00007f1f37ee8768 libcoreclr.so`ThreadNative::KickOffThread(pass=0x00007edde8004080) at comsynchronizable.cpp:228:9 [opt]
    frame #67: 0x00007f1f3820916e libcoreclr.so`CorUnix::CPalThread::ThreadEntry(pvParam=0x00007edde8001cf0) at thread.cpp:1760:16 [opt]
    frame #68: 0x00007f1f383c745c libc.so.6`start_thread(arg=<unavailable>) at pthread_create.c:444:8
    frame #69: 0x00007f1f38447bbc libc.so.6`__clone3 at clone3.S:81

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions