Skip to content

Jitdump contains only 2 stub records and no methods on .NET 10 (Linux x64) — writer silently disabled after truncated stub-block record; regression from .NET 9 #132935

Open

Description

@alf239

Description

On Linux x64 with DOTNET_PerfMapEnabled=2 (or 1), .NET 10.0.11 produces a jitdump file (/tmp/jit-<pid>.dump) containing exactly 2 records — both startup stubs, the second truncated — and no JIT_CODE_LOAD records for any managed method. This breaks perf inject --jit, samply symbolication, and Intel PT decode of managed code. The perfmap text file (PerfMapEnabled=1) is unaffected and lists all methods.

I searched open issues for "jitdump" and found no existing report of this. Upd: it's #120419 which is closed, hence the miss.

Reproduction Steps

dotnet new console -o hello && cd hello && dotnet build -c Release
DOTNET_PerfMapEnabled=2 ./bin/Release/net10.0/hello
ls -la /tmp/jit-*.dump

Count the records (any jitdump parser; quick check below):

import struct
data = open("/tmp/jit-<pid>.dump","rb").read()
off, counts = 40, {}
while off + 16 <= len(data):
    rid, tsz = struct.unpack("<II", data[off:off+8])
    if tsz == 0: break
    counts[rid] = counts.get(rid, 0) + 1
    off += tsz
print(len(data), counts)

Expected behavior

A jitdump containing JIT_CODE_LOAD records for the JIT-compiled managed methods (on .NET 8.0.30, the identical hello-world run produces 540,982 bytes / 1,360 records).

Actual behavior

33,281 bytes / 2 records, deterministically (byte-identical size across runs and across applications). Parsing shows:

  1. JIT_CODE_LOAD "stub InitThreadManagerPerfMapData<JIT_CopiedWriteBarriers>", 272 code bytes — intact;
  2. JIT_CODE_LOAD "stub ReportStubBlock" whose header claims 65,536 code bytes, but the file ends at 33,281 bytes — the record is truncated mid-write;
  3. nothing further, ever, although the same run with PerfMapEnabled=1 lists hundreds of methods in the perfmap.

Regression?

Yes — bisected across shipped runtimes (same machine, same hello-world binary via dotnet exec --fx-version):

Runtime jitdump Verdict
8.0.30 540,982 B / 1,360 records GOOD
9.0.0 95,217 B / 291 records GOOD
9.0.19 93,836 B / 287 records GOOD
10.0.0-preview.1.25080.5 100,687 B / 308 records GOOD
10.0.0-preview.2.25163.2 99,666 B / 305 records GOOD
10.0.0-preview.3.25171.5 99,647 B / 305 records GOOD
10.0.0-preview.4.25258.110 33,251 B / 2 records BAD
10.0.0-preview.5 … rc.2 33,251–33,281 B / 2 records BAD
10.0.0 (GA), 10.0.11 33,281 B / 2 records BAD

The only commit touching src/coreclr/vm/perfmap.cpp in the preview.3→preview.4 window is a45396c "Enhance logging of stubs through the PerfMap on Linux" (#113943) — which introduced the stub-block logging that produces the truncated ReportStubBlock<Unknown> record observed above, and also introduced the PerfMapStubGranularity config used in the workaround below.

Known Workarounds

DOTNET_PerfMapStubGranularity=4 (disable stub logging) fully restores method logging: the same hello-world produces 93,364 bytes / 280 records; a JIT-heavy app produces 1,758 records including OSR/tier versions.

Configuration

  • .NET 10.0.11 (regression vs 8.0.30), installed via dotnet-install script
  • Ubuntu 24.04 (kernel 6.8.0-138-generic), x86_64 (Xeon W-2295), bare metal
  • Reproduces with and without DOTNET_EnableWriteXorExecute=0

Other information

Analysis (hypothesis, from reading release/10.0 sources)

  • PerfMap::LogStubs (reached via ReportStubBlock) logs an entire stub code block including its code bytes through PAL_PerfJitDump_LogMethod, which writevs { &record, symbol, pCode/codeSize } (src/coreclr/pal/src/misc/perfjitdump.cpp).
  • The 64KB stub block appears not to be fully readable (reserved > committed?), so the gather write stops short and then fails — consistent with the truncated record observed.
  • The failure path calls FatalError(), which sets enabled = false permanently; every subsequent method record is silently dropped. The perfmap path never includes code bytes, which is why it is unaffected.

Suggested directions (happy to discuss/test): treat a failed record as skippable rather than fatal (or at least log the failure once); and/or avoid including code bytes for block-granularity stub records, or validate readability of the range first.

Activity

  1. added
    untriaged
    on Aug 29, 2026
  2. added
    area-CodeGen-coreclr
    on Aug 29, 2026
  3. dotnet-policy-service commented on Aug 29, 2026

    @dotnet-policy-service
    Contributor

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

  4. alf239 commented on Aug 29, 2026

    @alf239
    Author

    Updated with bisected versions.

  5. alf239 commented on Aug 29, 2026

    @alf239
    Author

    @davidwrighton may be interested it would seem?

  6. changed the title [-]Jitdump contains only 2 stub records and no methods on .NET 10 (Linux x64) — writer silently disabled after truncated stub-block record; regression from .NET 8[/-] [+]Jitdump contains only 2 stub records and no methods on .NET 10 (Linux x64) — writer silently disabled after truncated stub-block record; regression from .NET 9[/+] on Aug 29, 2026
  7. added and removed
    area-CodeGen-coreclr
    on Aug 30, 2026
  8. dotnet-policy-service commented on Aug 30, 2026

    @dotnet-policy-service
    Contributor

    Tagging subscribers to this area: @steveisok, @tommcdon, @dotnet/dotnet-diag
    See info in area-owners.md if you want to be subscribed.

  9. alf239 commented on Aug 30, 2026

    @alf239
    Author

    Apparently, this is #120419, fixed in main by #122274 but not backported to release/10.0.

    Digging further: the truncated ReportStubBlock<Unknown> record is produced by the block-granularity stub reporting introduced in #113943 (matching my bisect to 10.0.0-preview.4). ReportStubBlock fires when a stub code-heap block is created — at that point the 64KB region is reserved but mostly uncommitted. On release/10.0, PerfJitDumpState::LogMethod unconditionally includes {pCode, codeSize} in the writev iovec; the kernel copies the committed prefix (the truncated record in the file ends exactly at that boundary) and then fails, and FatalError() permanently disables the writer — hence 2 records and no methods, forever.

    #122274 (March 2026) fixes this in main by not reporting code bytes for block records (reportCodeBlock=false); I verified under strace on a main build that the same record is written with iov_len=0 and method records flow normally with default settings. However the fix is milestone 11.0.0 and release/10.0 (through 10.0.11) still reproduces.

    Since .NET 10 is LTS and this silently breaks DOTNET_PerfMapEnabled=1/2 (perf prefers a present-but-empty jitdump over the perfmap, per #122274's description), could #122274 be considered for 10.0.x servicing? It's a small, contained diff (20 insertions, 3 files).

    Happy to validate a backport build — I have the repro environment standing.

  10. removed
    untriaged
    on Sep 1, 2026
  11. added this to the 12.0.0 milestone on Sep 1, 2026
  12. steveisok commented on Sep 1, 2026

    @steveisok
    Member

    I triggered a backport of #122274 and we'll try to work it into .NET 10.

  13. alf239 commented on Sep 2, 2026

    @alf239
    Author

    Legendary, thank you!

  14. alf239 commented on Oct 18, 2026

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

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions