8000 Refresh JIT address caches between export cycles by r1viollet · Pull Request #566 · DataDog/ddprof · GitHub
[go: up one dir, main page]

Skip to content

Refresh JIT address caches between export cycles - #566

Draft
r1viollet wants to merge 3 commits into
mainfrom
r1viollet/fix-jit-cache-refresh
Draft

r1viollet wants to merge 3 commits into
mainfrom
r1viollet/fix-jit-cache-refresh

Conversation

@r1viollet
Copy link
Copy Markdown
Collaborator

What does this PR do?

Expire JIT/perf-map address caches at each export cycle, so successful address hits cannot keep an old function name indefinitely. Keep symbol-table entries immutable and reuse their indices through the canonical dictionary function handle.

Motivation

Successful lookups bypass source refreshes. If a runtime reuses a code address and samples continue hitting cached ranges, neither a changed perf-map nor a changed jitdump is read again, even across export cycles.

Re-reading the source also previously changed existing symbol-table entries in place. Saved live-allocation stacks referencing those indices could then acquire a different function name.

Additional Notes

This deliberately bounds cache freshness to an export cycle, rather than adding filesystem checks to every successful lookup. Active JIT sources are reloaded lazily on their next use after each cycle. Within a cycle, existing miss/growth-retry behavior remains unchanged, so address reuse is not necessarily noticed immediately.

Trade-offs:

  • Active sources are reparsed after each cycle. No overhead benchmark has been run.
  • A source that becomes inaccessible cannot repopulate its expired address map.
  • A function-handle-to-symbol-index map retains one entry per distinct JIT function for the worker lifetime. It avoids duplicate table growth on repeated reloads and preserves indices held by saved stacks.

No public ABI change. This PR does not redesign JIT range-overlap handling or add incremental jitdump parsing. Independent of #563, #564 and #565.

How to test the change?

Added four regression tests covering:

  • Perf-map address reuse across cycles, with old symbols preserved and indices reused on unchanged reloads.
  • Replacing a symbol after a same-cycle miss without mutating saved symbol records.
  • Removing an address from a perf-map between cycles.
  • Same-size jitdump symbol replacement at an already cached address across cycles.

Validated on x86_64 Ubuntu 24 / GCC 14:

  • All four regressions fail against the original implementation and pass with the fix.
  • All 17 runtime_symbol_lookup-ut tests and the ddprof build pass with libdatadog v30 and v46.
  • Full v30 Debug build passes; 51/51 tests pass after excluding the three previously reproduced baseline failures (ipc-ut and both simple_malloc variants).
  • Formatting and git diff --check pass.

Alpine and aarch64 have not been run locally.

@datadog-official
datadog-official Bot commented Oct 20, 2026 •
Copy link
Copy Markdown

Pipelines

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 3c13356 | Docs | Give us feedback!

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

0