Skip to content

.NET apps abort in ".NET BGC" / ".NET TP Worker" threads (GPF in libc.so.6 +0x289a2) on Ubuntu 26.04 hosts, kernel 7.0.0-34 (Kubernetes/containerd) #136603

Closed

Description

@asyncfinkd

Description

Since ~2026-10-28, several ASP.NET Core (.NET 10) services in our Kubernetes cluster crash repeatedly (exit code 139, CrashLoopBackOff). The process dies without any managed exception or log output. The host kernel log shows the same trap for every crash, always in .NET BGC or .NET TP Worker threads, always at the same offset in libc:

traps: .NET BGC[4026684] general protection fault ip:7381636509a2 sp:737fcfffea70 error:0 in libc.so.6[289a2,738163650000+189000]
traps: .NET TP Worker[4024979] general protection fault ip:7dcbf5c9a9a2 sp:7dcac77f5620 error:0 in libc.so.6[289a2,7dcbf5c9a000+189000]

Out of 40 traps collected on one node: 18 in .NET BGC, 22 in .NET TP Worker. The sp of the BGC traps always ends in ...a70 (same stack depth every time). The offset +0x289a2 appears to be the hlt fallback inside abort() (as also analysed in Cleanuparr/Cleanuparr#873), i.e. the runtime is aborting itself.

A process typically survives ~19 s idle (until readiness lets traffic in) and then dies < 1 s to ~16 s after the first requests, even when those are only GET /health and CORS OPTIONS preflights. That suggests the crash happens at the first GCs, not in a specific code path.

Reproduction Steps

No minimal repro yet. Any of our affected ASP.NET Core services crashes within seconds of receiving traffic when scheduled on the affected hosts (see Configuration).

The same images do not crash on an arm64 Ubuntu 24.04 VM (kernel 6.8, Docker) under sustained load (~60k requests, 1 CPU / 1 GiB limits).

Expected behavior

No crash. The same images/code ran for months without this problem.

Actual behavior

The process aborts repeatedly (container exit code 139, Kubernetes CrashLoopBackOff). No managed exception, no "Fatal error" text, application logs simply stop. Kernel log shows the GPF in libc quoted in the Description.

Native stack / core dump: [TODO: coredumpctl info <PID> output, or "core dumps not captured"]

Regression?

Yes, started ~2026-10-28 (first trap on the node: [TODO]).

It is not tied to the .NET version: reproduced with runtime 10.0.14, 10.0.12 and 10.0.5 (verified via libcoreclr.so SHA-256 against the official runtime packs), both self-contained and framework-dependent. Reverting application code to a known-good commit and switching base image (noble / jammy) did not help either.

Known Workarounds

Configuration

.NET: 10.0.14 (also reproduced on 10.0.12, 10.0.5), linux-x64, ASP.NET Core

Host (Kubernetes nodes)

  • Ubuntu 26.04.1 LTS, kernel 7.0.0-34-generic, x86_64
  • RKE2 v1.36.3+rke2r1, containerd 2.3.3-k3s1
  • Swap enabled on nodes (8 GiB)
  • CPU model / hypervisor: [TODO], AVX2: [TODO]
  • Previous kernel before 7.0.0-34: [TODO]

Container

  • mcr.microsoft.com/dotnet/aspnet:10.0 (Ubuntu 24.04.5, glibc 2.39-0ubuntu8.9); also tried jammy
  • Limits 1 CPU / 1 GiB (requests 50m / 128Mi), non-root UID 65000

Affected vs. unaffected (same nodes, same kernel)

Service CPU limit Notes Result
A: YARP reverse proxy 1 crashes
B: ASP.NET Core API 1 New Relic profiler crashes
C: ASP.NET Core + Quartz jobs 1 crashes
D: worker service 1 16 restarts / 4.3 days
E: ASP.NET Core API 2 New Relic profiler stable
F: ASP.NET Core API 1 low traffic stable

Other information

Ruled out:

  • AppArmor: no apparmor="DENIED" entries in the kernel log since 2026-10-28.
  • OOM / resources: no OOM events; memory 20–32% of limit; CPU ~1% of limit.
  • Runtime version / base image / app code: see Regression.
  • overflowed sigaltstack in kernel log: [TODO: yes/no]

Possibly related:

Happy to collect additional diagnostics (createdump, specific env vars). Please advise.

Activity

  1. added
    untriaged
    on Oct 28, 2026
  2. dotnet-policy-service commented on Oct 28, 2026

    @dotnet-policy-service
    Contributor

    Tagging subscribers to this area: @agocke
    See info in area-owners.md if you want to be subscribed.

  3. asyncfinkd commented on Oct 28, 2026

    @asyncfinkd
    ContributorAuthor

    Some additional information since opening the issue:

    Host details (same on all affected worker nodes)

    • CPU: [TODO: lscpu | grep "Model name"]
    • Hypervisor: [TODO: lscpu | grep "Hypervisor vendor", or "bare metal"]
    • AVX2 / AVX-512: [TODO: grep -o -w -E "avx2|avx512f" /proc/cpuinfo | sort -u]
    • Kernel 7.0.0-34-generic since: [TODO: date from journalctl --list-boots]; previous kernel: [TODO]
    • Recent package updates on the nodes: [TODO: relevant lines from /var/log/apt/history.log, or "none since "]
    • No overflowed sigaltstack and no apparmor="DENIED" entries in the kernel log.

    Workaround status

    • DOTNET_gcServer=0 + DOTNET_gcConcurrent=0: [TODO: "crashes stopped" / "only .NET TP Worker traps remain" / "no change"]

    What we checked elsewhere

    Questions

    1. The process dies without printing any Fatal error. / FailFast message to stderr before the abort(). Is there a way to get the runtime to log why it is aborting (e.g. a specific env var or logging setting)?
    2. What is the recommended way to capture a usable native stack here? Minidumps written inside the container are lost on restart. Would DOTNET_DbgEnableMiniDump=1 + DOTNET_EnableCrashReport=1 to a mounted volume be enough, or do you prefer a full createdump?

    We can run any diagnostic build or env-var configuration you suggest.

  4. jkotas commented on Oct 28, 2026

    @jkotas
    Member

    Would DOTNET_DbgEnableMiniDump=1 + DOTNET_EnableCrashReport=1 to a mounted volume be enough, or do you prefer a full createdump?

    Full createdump is better. Once you collect the dump, the next step is to load it into unmanaged debugger (lldb) and get the stacktrace.

  5. added
    tenet-reliability
    on Oct 28, 2026
  6. asyncfinkd commented on Oct 30, 2026

    @asyncfinkd
    ContributorAuthor

    Resolved — root cause: AppArmor blocking thread-directed signals (not a .NET bug)

    Closing this, as the root cause turned out to be in the environment. Posting the details in case it helps others hitting the same libc.so.6[289a2] trap in .NET BGC / .NET TP Worker.

    Root cause

    On the Kubernetes worker nodes (RKE2 + containerd, Ubuntu), containers ran under the stacked AppArmor profile:

    cri-containerd.apparmor.d//&unconfined (enforce)
    

    Under this confinement a process was not allowed to send signals to its own threads. CoreCLR suspends managed threads for GC via thread-directed signals (activation injection). When that signal is denied, the runtime cannot suspend the thread and aborts. That is the abort() → hlt fallback seen as the general protection fault in libc.

    How it was confirmed

    1. A core dump analysed with GDB + CoreCLR symbols showed the abort coming from GC thread suspension:
      abort()
      └── PROCAbort()
          └── InjectActivationInternal()
              └── PAL_InjectActivation()
                  └── Thread::InjectActivation()
                      └── Thread::Hijack()
                          └── ThreadSuspend::SuspendAllThreads()
                              └── ThreadSuspend::SuspendEE()
                                  └── GCToEEInterface::SuspendEE()
                                      └── GCHeap::GarbageCollectGeneration()
      
    2. A minimal native test inside an affected container (no .NET involved): both pthread_kill() and tgkill() to a thread of the same process failed with EACCES (13) Permission denied.

    Why it looked like an application/.NET problem

    • Changing the .NET runtime version, the base image, or the application code made no difference. An old, previously working image crashed as well.
    • Crash frequency scaled with load. Busy services crashed within seconds of receiving traffic (more GCs → more thread suspensions), while low-traffic services on the same nodes ran for days.
    • dotnet publish in CI jobs running on the same cluster also failed with exit code 139, because the SDK process also runs GC.
    • No apparmor="DENIED" lines appeared in journalctl -k, so we initially ruled AppArmor out. If you suspect this, test tgkill() directly inside the container, and check the audit log (/var/log/audit/audit.log) as well as the kernel log.

    Fix

    AppArmor confinement was removed for the affected workloads on the worker nodes. After that, all .NET 10 services and the CI pipelines ran normally. No application changes were needed. Narrower alternatives: allow signal within the container's own (stacked) label in the profile, or set securityContext.appArmorProfile.type: Unconfined on the affected pods only.

    Related: TetronIO/JIM#1953 (same mechanism with a stacked profile under Podman), Cleanuparr/Cleanuparr#873 (same trap signature).

    Suggestion for the runtime: when pthread_kill / tgkill fails during thread suspension, the process aborts silently. A short message such as "failed to inject activation: errno=13 (EACCES)" before the abort would have pointed to the cause immediately. Happy to open a separate issue for that if useful.

  7. removed
    untriaged
    on Oct 30, 2026
  8. jkotas commented on Oct 30, 2026

    @jkotas
    Member

    A short message such as "failed to inject activation: errno=13 (EACCES)" before the abort would have pointed to the cause immediately. Happy to open a separate issue for that if useful.

    Yes, it sounds like a good. You can just open a PR with the proposed fix.

  9. asyncfinkd commented on Oct 30, 2026

    @asyncfinkd
    ContributorAuthor

    Opened #136713 with the proposed change: it prints the pthread_kill error (e.g. Permission denied (13)) before the abort in InjectActivationInternal. Thanks for the quick feedback!

  10. jeremy-morren commented on Nov 21, 2026

    @jeremy-morren

    Deterministic repro (about 2 s) for this environment issue: an EventPipe session with the sample profiler, while the app is busy, hits the same activation-injection abort.

    var builder = WebApplication.CreateSlimBuilder(args);
    builder.WebHost.UseUrls("http://127.0.0.1:5000");
    var app = builder.Build();
    app.MapGet("/", () => "ok");
    await app.StartAsync();
    Console.WriteLine($"pid {Environment.ProcessId}");
    var client = new HttpClient { BaseAddress = new Uri("http://127.0.0.1:5000") };
    for (var i = 0; i < 8; i++) _ = Task.Run(async () => { while (true) await client.GetStringAsync("/"); });
    await Task.Delay(-1);

    Run it in a container under containerd's default AppArmor profile (cri-containerd.apparmor.d//&unconfined, Ubuntu 26.04 kernel 7.0.0-42, k3s v1.36.5 / containerd v2.3.4-k3s), then:

    dotnet-trace collect -p <pid> --providers Microsoft-DotNETCore-SampleProfiler

    The process exits with 139 (.NET EventPipe ... general protection fault ... in libc.so.6[289a2]). It survives on the same host outside a container, with DOTNET_INTERNAL_ThreadSuspendInjection=0, or with the pod's AppArmor profile Unconfined. Fix: containerd/containerd#14487.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-VM-coreclrtenet-reliability

    Type

    No type

    Projects

    • Status
      No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions