Description
After upgrading our service to .NET 10 (10.0.626.17701) and updating several libraries including MongoDB.Driver, the service started crashing regularly with SIGSEGV — 3–4 times per week on the same build. The crashes are non-deterministic: different OS threads each time, same method each time.
The dump shows the crash occurring inside CLR's native RuntimeHelpers.CompileMethod(), invoked from System.Linq.Expressions.Compiler.LambdaCompiler.CreateDelegate() at LambdaCompiler.cs line 265.
The dump also shows two simultaneously live OptimizedTier1 code versions for CreateDelegate — one OptimizedTier1 + Instrumented and one OptimizedTier1 — indicating the JIT was in the middle of a tier transition at crash time.
LambdaExpression.Compile() was being called repeatedly and concurrently from a hot path via MongoDB.Driver LINQ3's PartialEvaluator.SubtreeEvaluator.Evaluate(), which calls Compile() on every invocation of ExpressionFilterDefinition.Render(). CPU had doubled in the 15 minutes before the crash.
Reproduction Steps
The full dump and crashreport.json cannot be shared publicly as they contain references to proprietary application code. The relevant excerpts produced by the analysis script are included in the Script output section below.
The following script reproduces the analysis (requires dotnet-dump, PowerShell 7+):
$DUMP = "<path to .dmp file>"
$REPORT = "<path to .dmp.crashreport.json file>"
function Main {
function Section($title) {
Write-Host "`n$('=' * 70)" -ForegroundColor Cyan
Write-Host " $title" -ForegroundColor Cyan
Write-Host "$('=' * 70)" -ForegroundColor Cyan
}
Section "1 — Crashed thread in crashreport.json"
$hit = Select-String -Path $REPORT -Pattern '"crashed":\s*"true"' | Select-Object -First 1
Write-Host " Line $($hit.LineNumber): $($hit.Line.Trim())"
$done = $false
Get-Content $REPORT |
Select-Object -Skip ($hit.LineNumber - 5) -First 220 |
Select-String -Pattern 'native_thread_id|"is_managed"|"IP"|"SP"|"method_name"' |
ForEach-Object {
if ($done) { return }
$_
if ($_ -match '"method_name"' -and $_ -match 'FindOneAndUpdateAsync') {
" [application code — ...]"
$done = $true
}
}
Section "2 — clrthreads: crashed thread row (GC mode Cooperative)"
# Replace 17e1 with native_thread_id from step 1; note DBG column (first) vs managed ID (second)
"clrthreads`nexit" | dotnet-dump analyze $DUMP 2>&1 | Select-String -Pattern "17e1|^\s+ID\s"
Section "3 — ip2md: return address into CreateDelegate → method + JIT versions"
# 0x7f61dcdaacf6 is the return address from CompileMethod back into CreateDelegate @ 265
"ip2md 0x7f61dcdaacf6`nexit" | dotnet-dump analyze $DUMP 2>&1
Section "4 — clrstack on crashed thread (use DBG column from step 2, not managed ID)"
# DBG=923 (first column), managed ID=447 (second column) — these are different
$done = $false
"setthread 923`nclrstack`npe`nexit" | dotnet-dump analyze $DUMP 2>&1 | ForEach-Object {
if ($done) { return }
$_
if ($_ -match 'FindOneAndUpdateAsync') {
" [application code — ...]"
$done = $true
}
}
Section "5 — dumpmd: confirm two live NativeCodeVersions"
# Replace MethodDesc with value from step 3
"dumpmd 00007f61d4f956b8`nexit" | dotnet-dump analyze $DUMP 2>&1
Section "6 — Stack depth (rule out stack overflow)"
# Extract SP values directly from clrstack output on the crashed thread (use DBG ID from step 2)
$stackOut = "setthread 923`nclrstack`nexit" | dotnet-dump analyze $DUMP 2>&1
$spValues = $stackOut | Select-String -Pattern '^\s*(00007F[0-9A-Fa-f]+)\s+[0-9A-Fa-f]+\s' |
ForEach-Object { [uint64]("0x" + $_.Matches[0].Groups[1].Value) } | Sort-Object
$min = $spValues | Select-Object -First 1
$max = $spValues | Select-Object -Last 1
" SP range: 0x{0:x} – 0x{1:x} ({2} bytes = {3:F2} KB used of ~1024 KB limit)" -f $min, $max, ($max - $min), (($max - $min) / 1KB)
Section "7 — Crash offset: return address into CreateDelegate"
$codeStart = [uint64]"0x7f61dcdaab70" # OptimizedTier1 CodeAddr from step 3
$returnAddr = [uint64]"0x7f61dcdaacf6" # return address into CreateDelegate (ip2md input)
$ctxIP = [uint64]"0x7f624d8da813" # ctx.IP from crashreport.json — wait4 in libc.so.6 (signal-handler chain at dump time)
" OptimizedTier1 CodeAddr: 0x{0:x}" -f $codeStart
" Return addr into CreateDelegate: 0x{0:x} (+0x{1:x} = {1} bytes)" -f $returnAddr, ($returnAddr - $codeStart)
" ctx.IP at dump time: 0x{0:x} (wait4 in libc.so.6 — signal-handler chain, not the faulting instruction)" -f $ctxIP
# To disassemble (Linux only):
# dotnet-dump analyze <dump> -c "clru 00007f61d4f956b8"
}
Main
Script output:
======================================================================
1 — Crashed thread in crashreport.json
======================================================================
Line 174099: "crashed": "true",
"is_managed": "true",
"native_thread_id": "0x17e1",
"IP": "0x7f624d8da813",
"SP": "0x7f62484691c0",
"is_managed": "true",
"is_managed": "true",
"method_name": "System.Linq.Expressions.LambdaExpression.Compile()",
"is_managed": "true",
"method_name": "MongoDB.Driver.Linq.Linq3Implementation.Misc.PartialEvaluator+SubtreeEvaluator.Evaluate(System.Linq.Expressions.Expression)",
"is_managed": "true",
"method_name": "MongoDB.Driver.Linq.Linq3Implementation.Misc.PartialEvaluator+SubtreeEvaluator.VisitBinary(System.Linq.Expressions.BinaryExpression)",
"is_managed": "true",
"method_name": "MongoDB.Driver.Linq.Linq3Implementation.Misc.PartialEvaluator+SubtreeEvaluator.VisitBinary(System.Linq.Expressions.BinaryExpression)",
"is_managed": "true",
"method_name": "MongoDB.Driver.Linq.Linq3Implementation.Misc.PartialEvaluator+SubtreeEvaluator.VisitBinary(System.Linq.Expressions.BinaryExpression)",
"is_managed": "true",
"method_name": "System.Linq.Expressions.ExpressionVisitor.VisitLambda[[System.__Canon, System.Private.CoreLib]](System.Linq.Expressions.Expression`1<System.__Canon>)",
"is_managed": "true",
"method_name": "MongoDB.Driver.ExpressionFilterDefinition`1[[System.__Canon, System.Private.CoreLib]].Render(MongoDB.Driver.RenderArgs`1<System.__Canon>)",
"is_managed": "true",
"method_name": "MongoDB.Driver.MongoCollectionImpl`1[[System.__Canon, System.Private.CoreLib]].CreateFindOneAndUpdateOperation[[System.__Canon, System.Private.CoreLib]](MongoDB.Driver.FilterDefinition`1<System.__Canon>, MongoDB.Driver.UpdateDefinition`1<System.__
Canon>, MongoDB.Driver.FindOneAndUpdateOptions`2<System.__Canon,System.__Canon>)",
"is_managed": "true",
"method_name": "MongoDB.Driver.MongoCollectionImpl`1+<FindOneAndUpdateAsync>d__67`1[[System.__Canon, System.Private.CoreLib],[System.__Canon, System.Private.CoreLib]].MoveNext()",
[application code — ...]
======================================================================
2 — clrthreads: crashed thread row (GC mode Cooperative)
======================================================================
923 447 17e1 00007F5898088020 1021260 Cooperative 0000000000000000:0000000000000000 000055D8BA71CF00 -00001 Ukn (Threadpool Worker)
======================================================================
3 — ip2md: return address into CreateDelegate → method + JIT versions
======================================================================
Loading core dump: <path to .dmp file> ...
Ready to process analysis commands. Type 'help' to list available commands or 'help [command]' to get detailed help on a command.
Type 'quit' or 'exit' to exit the session.
<END_COMMAND_OUTPUT>
> ip2md 0x7f61dcdaacf6
MethodDesc: 00007f61d4f956b8
Method Name: System.Linq.Expressions.Compiler.LambdaCompiler.CreateDelegate()
Class: 00007f61d4f967b8
MethodTable: 00007f61d4f967b8
mdToken: 0000000006000F6C
Module: 00007f61d05073b8
IsJitted: yes
Current CodeAddr: 00007f61dcdaab70
Version History:
ILCodeVersion: 0000000000000000
ReJIT ID: 0
IL Addr: 00007f61d0746988
CodeAddr: 00007f61dc08ba70 (OptimizedTier1 + Instrumented)
NativeCodeVersion: 00007F5914241AC0
CodeAddr: 00007f61dcdaab70 (OptimizedTier1)
NativeCodeVersion: 00007F5914587FE0
CodeAddr: 00007f61d0598580 (ReadyToRun)
NativeCodeVersion: 0000000000000000
Source file: /_/src/runtime/src/libraries/System.Linq.Expressions/src/System/Linq/Expressions/Compiler/LambdaCompiler.cs @ 265
<END_COMMAND_OUTPUT>
> exit
======================================================================
4 — clrstack on crashed thread (use DBG column from step 2, not managed ID)
======================================================================
Loading core dump: <path to .dmp file> ...
Ready to process analysis commands. Type 'help' to list available commands or 'help [command]' to get detailed help on a command.
Type 'quit' or 'exit' to exit the session.
<END_COMMAND_OUTPUT>
> setthread 923
<END_COMMAND_OUTPUT>
> clrstack
OS Thread Id: 0x17e1 (923)
Child SP IP Call Site
00007F5756D096C0 00007f624d8da813 [InlinedCallFrame: 00007f5756d096c0] System.Runtime.CompilerServices.RuntimeHelpers.CompileMethod(System.RuntimeMethodHandleInternal)
00007F5756D096C0 00007f61dcdaacf6 [InlinedCallFrame: 00007f5756d096c0] System.Runtime.CompilerServices.RuntimeHelpers.CompileMethod(System.RuntimeMethodHandleInternal)
00007F5756D096A0 00007F61DCDAACF6 System.Linq.Expressions.Compiler.LambdaCompiler.CreateDelegate() [/_/src/runtime/src/libraries/System.Linq.Expressions/src/System/Linq/Expressions/Compiler/LambdaCompiler.cs @ 265]
00007F5756D09730 00007F61DCDB19FE System.Linq.Expressions.LambdaExpression.Compile() [/_/src/runtime/src/libraries/System.Linq.Expressions/src/System/Linq/Expressions/LambdaExpression.cs @ 141]
00007F5756D09840 00007F61DF534D27 MongoDB.Driver.Linq.Linq3Implementation.Misc.PartialEvaluator+SubtreeEvaluator.Evaluate(System.Linq.Expressions.Expression)
00007F5756D099C0 00007F61DF534499 MongoDB.Driver.Linq.Linq3Implementation.Misc.PartialEvaluator+SubtreeEvaluator.VisitBinary(System.Linq.Expressions.BinaryExpression)
00007F5756D09A30 00007F61DF53479A MongoDB.Driver.Linq.Linq3Implementation.Misc.PartialEvaluator+SubtreeEvaluator.VisitBinary(System.Linq.Expressions.BinaryExpression)
00007F5756D09AA0 00007F61DF5346CC MongoDB.Driver.Linq.Linq3Implementation.Misc.PartialEvaluator+SubtreeEvaluator.VisitBinary(System.Linq.Expressions.BinaryExpression)
00007F5756D09B10 00007F61DD7C6819 System.Linq.Expressions.ExpressionVisitor.VisitLambda[[System.__Canon, System.Private.CoreLib]](System.Linq.Expressions.Expression`1<System.__Canon>)
00007F5756D09B80 00007F61DF533D92 MongoDB.Driver.ExpressionFilterDefinition`1[[System.__Canon, System.Private.CoreLib]].Render(MongoDB.Driver.RenderArgs`1<System.__Canon>)
00007F5756D09CF0 00007F61E2906053 MongoDB.Driver.MongoCollectionImpl`1[[System.__Canon, System.Private.CoreLib]].CreateFindOneAndUpdateOperation[[System.__Canon, System.Private.CoreLib]](MongoDB.Driver.FilterDefinition`1<System.__Canon>, MongoDB.Driver.UpdateDefinition`1<System.__Canon>, MongoDB.Driver.FindOneAndUpdateOptions`2<System.__Canon,System.__Canon>)
00007F5756D09F90 00007F61E34C0780 MongoDB.Driver.MongoCollectionImpl`1+<FindOneAndUpdateAsync>d__67`1[[System.__Canon, System.Private.CoreLib],[System.__Canon, System.Private.CoreLib]].MoveNext()
[application code — ...]
<END_COMMAND_OUTPUT>
> pe
There is no current managed exception on this thread
<END_COMMAND_OUTPUT>
> exit
======================================================================
5 — dumpmd: confirm two live NativeCodeVersions
======================================================================
Loading core dump: <path to .dmp file> ...
Ready to process analysis commands. Type 'help' to list available commands or 'help [command]' to get detailed help on a command.
Type 'quit' or 'exit' to exit the session.
<END_COMMAND_OUTPUT>
> dumpmd 00007f61d4f956b8
Method Name: System.Linq.Expressions.Compiler.LambdaCompiler.CreateDelegate()
Class: 00007f61d4f967b8
MethodTable: 00007f61d4f967b8
mdToken: 0000000006000F6C
Module: 00007f61d05073b8
IsJitted: yes
Current CodeAddr: 00007f61dcdaab70
Version History:
ILCodeVersion: 0000000000000000
ReJIT ID: 0
IL Addr: 00007f61d0746988
CodeAddr: 00007f61dc08ba70 (OptimizedTier1 + Instrumented)
NativeCodeVersion: 00007F5914241AC0
CodeAddr: 00007f61dcdaab70 (OptimizedTier1)
NativeCodeVersion: 00007F5914587FE0
CodeAddr: 00007f61d0598580 (ReadyToRun)
NativeCodeVersion: 0000000000000000
<END_COMMAND_OUTPUT>
> exit
======================================================================
6 — Stack depth (rule out stack overflow)
======================================================================
SP range: 0x7f5756d096a0 – 0x7f5756d0bd30 (9872 bytes = 9,64 KB used of ~1024 KB limit)
======================================================================
7 — Crash offset: return address into CreateDelegate
======================================================================
OptimizedTier1 CodeAddr: 0x7f61dcdaab70
Return addr into CreateDelegate: 0x7f61dcdaacf6 (+0x186 = 390 bytes)
ctx.IP at dump time: 0x7f624d8da813 (wait4 in libc.so.6 — signal-handler chain, not the faulting instruction)
Expected behavior
LambdaExpression.Compile() called concurrently from multiple ThreadPool threads should not cause
a SIGSEGV. The JIT's tiered recompilation of an internal method should be safe with respect to
concurrent threads executing that method.
Actual behavior
SIGSEGV (signal 11) in the CLR's native RuntimeHelpers.CompileMethod(), called from
LambdaCompiler.CreateDelegate() at LambdaCompiler.cs line 265. The crash is non-deterministic:
three occurrences on the same build, different OS threads each time. The crashed thread's GC mode
is Cooperative (all other threads: Preemptive), confirming it was inside CLR-managed JIT
infrastructure at the time of the fault.
ip2md/dumpmd show two simultaneously live OptimizedTier1 code versions for CreateDelegate
at crash time — OptimizedTier1 + Instrumented (NativeCodeVersion non-null, still live) and
OptimizedTier1 (current) — consistent with the JIT being mid-transition between tiers when the
fault occurred.
Regression?
Unknown. We are running .NET 10 prerelease 10.0.626.17701 and have not tested earlier builds.
The service started crashing after upgrading to this build.
Known Workarounds
No response
Configuration
- .NET version:
10.0.626.17701
- OS: Linux x64
- Container: Docker, Kubernetes pod
- Threads at crash time: ~950 OS threads, 298 managed CLR threads
Other information
Hypotheses ruled out:
| Hypothesis |
Verdict |
Evidence |
| Stack overflow |
❌ Ruled out |
Stack used ~9.6 KB of ~1 MB ThreadPool limit (SP range: 0x7f5756d096a0–0x7f5756d0bd30) |
| OOM / memory pressure |
❌ Ruled out |
Container memory well below limit; pod state Error not OOMKilled |
| CPU saturation |
❌ Ruled out |
~4.7 cores of 8 available at crash time |
| Lock contention deadlock |
❌ Ruled out |
Lock contention elevated but produces no SIGSEGV |
| Native user library crash |
❌ Ruled out |
Non-managed frames are libcoreclr.so + libc.so.6 (CLR signal handling chain) — no third-party native library |
| Thrown .NET exception |
❌ Ruled out |
pe on crashed thread: "There is no current managed exception on this thread" |
Description
After upgrading our service to .NET 10 (
10.0.626.17701) and updating several libraries including MongoDB.Driver, the service started crashing regularly with SIGSEGV — 3–4 times per week on the same build. The crashes are non-deterministic: different OS threads each time, same method each time.The dump shows the crash occurring inside CLR's native
RuntimeHelpers.CompileMethod(), invoked fromSystem.Linq.Expressions.Compiler.LambdaCompiler.CreateDelegate()at LambdaCompiler.cs line 265.The dump also shows two simultaneously live
OptimizedTier1code versions forCreateDelegate— oneOptimizedTier1 + Instrumentedand oneOptimizedTier1— indicating the JIT was in the middle of a tier transition at crash time.LambdaExpression.Compile()was being called repeatedly and concurrently from a hot path viaMongoDB.DriverLINQ3'sPartialEvaluator.SubtreeEvaluator.Evaluate(), which callsCompile()on every invocation ofExpressionFilterDefinition.Render(). CPU had doubled in the 15 minutes before the crash.Reproduction Steps
The full dump and crashreport.json cannot be shared publicly as they contain references to proprietary application code. The relevant excerpts produced by the analysis script are included in the Script output section below.
The following script reproduces the analysis (requires
dotnet-dump, PowerShell 7+):Script output:
Expected behavior
LambdaExpression.Compile()called concurrently from multiple ThreadPool threads should not causea SIGSEGV. The JIT's tiered recompilation of an internal method should be safe with respect to
concurrent threads executing that method.
Actual behavior
SIGSEGV (signal 11) in the CLR's native
RuntimeHelpers.CompileMethod(), called fromLambdaCompiler.CreateDelegate()at LambdaCompiler.cs line 265. The crash is non-deterministic:three occurrences on the same build, different OS threads each time. The crashed thread's GC mode
is
Cooperative(all other threads:Preemptive), confirming it was inside CLR-managed JITinfrastructure at the time of the fault.
ip2md/dumpmdshow two simultaneously liveOptimizedTier1code versions forCreateDelegateat crash time —
OptimizedTier1 + Instrumented(NativeCodeVersion non-null, still live) andOptimizedTier1(current) — consistent with the JIT being mid-transition between tiers when thefault occurred.
Regression?
Unknown. We are running .NET 10 prerelease
10.0.626.17701and have not tested earlier builds.The service started crashing after upgrading to this build.
Known Workarounds
No response
Configuration
10.0.626.17701Other information
Hypotheses ruled out:
0x7f5756d096a0–0x7f5756d0bd30)ErrornotOOMKilledlibcoreclr.so+libc.so.6(CLR signal handling chain) — no third-party native librarypeon crashed thread: "There is no current managed exception on this thread"