Skip to content

🐛 Preserve in-flight debugger probe entries on removal#4688

Merged
watson merged 1 commit into
mainfrom
watson/debugger-removal-race
May 29, 2026
Merged

🐛 Preserve in-flight debugger probe entries on removal#4688
watson merged 1 commit into
mainfrom
watson/debugger-removal-race

Conversation

@watson
Copy link
Copy Markdown
Collaborator

@watson watson commented May 27, 2026

Motivation

Removing a debugger probe used to clear its active entry stack immediately. For reentrant or recursive instrumented functions, this could drop an outer frame's pending snapshot if an inner frame exhausted the lifetime budget or if the probe was removed while the outer frame was still in flight.

Changes

  • Move active entry bookkeeping onto each initialized probe instance instead of a global map keyed by probe id.
  • Let removed probe instances drain already accepted in-flight entries, while preventing future entries through the probe registry.
  • Add identity-checked removeProbe(probe) behavior so stale in-flight probe instances cannot remove a newer replacement with the same probe id.
  • Centralize lifetime budget transitions in enforceProbeLifetimeBudget() and recordProbeEventSent().
  • Document that clearProbes() remains aggressive teardown for tests and the delivery API circuit breaker.
  • Add unit coverage for recursive lifetime-budget draining, replacement isolation, and the removeProbe(probe) overload contract.

Test instructions

Run:

yarn test:unit --spec packages/debugger/src/domain/api.spec.ts --spec packages/debugger/src/domain/probes.spec.ts

Checklist

  • Tested locally
  • Tested on staging
  • Added unit tests for this change.
  • Added e2e/integration tests for this change.
  • Updated documentation and/or relevant AGENTS.md file

@watson watson requested review from a team as code owners May 27, 2026 17:25
Copy link
Copy Markdown
Collaborator Author

watson commented May 27, 2026

This stack of pull requests is managed by Graphite. Learn more about stacking.

@cit-pr-commenter-54b7da
Copy link
Copy Markdown

cit-pr-commenter-54b7da Bot commented May 27, 2026

Bundles Sizes Evolution

📦 Bundle Name Base Size Local Size 𝚫 𝚫% Status
Rum 173.69 KiB 173.69 KiB 0 B 0.00%
Rum Profiler 8.08 KiB 8.08 KiB 0 B 0.00%
Rum Recorder 21.24 KiB 21.24 KiB 0 B 0.00%
Logs 55.47 KiB 55.47 KiB 0 B 0.00%
Rum Slim 131.39 KiB 131.39 KiB 0 B 0.00%
Worker 22.99 KiB 22.99 KiB 0 B 0.00%

🔗 RealWorld

@datadog-prod-us1-5
Copy link
Copy Markdown

datadog-prod-us1-5 Bot commented May 27, 2026

Tests

🎉 All green!

🧪 All tests passed
❄️ No new flaky tests detected

🎯 Code Coverage (details)
Patch Coverage: 68.57%
Overall Coverage: 76.72% (-0.04%)

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 8c773e4 | Docs | Datadog PR Page | Give us feedback!

@watson watson force-pushed the watson/debugger-removal-race branch from 244090e to 8c773e4 Compare May 28, 2026 12:25
@watson
Copy link
Copy Markdown
Collaborator Author

watson commented May 28, 2026

Had to push again to resolve a merge conflict + a logic conflict with some of the changes that had landed in main.

@watson watson merged commit 3bd1fec into main May 29, 2026
31 checks passed
@watson watson deleted the watson/debugger-removal-race branch May 29, 2026 09:50
@github-actions github-actions Bot locked and limited conversation to collaborators May 29, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants