Skip to content

Conversation

@szegedi
Copy link

@szegedi szegedi commented Jan 15, 2026

What does this PR do?:
Removes the Isolate::IsDead() check from the time profiler signal handler.

Motivation:
We're seeing SIGSEGV when IsDead is invoked from our signal handler. It's weird on the surface of it, because if we get back a non-null v8::Isolate* from Isolate::GetCurrent() call, an IsDead() check should complete successfully on it. However, in this particular case, the PROF signal is triggered while munmap is on the stack, it might somehow contribute to it.

Additional Notes:
This IsDead() check was added speculatively with #197 and there was never evidence that it actually helps matters. It's quite possible that under the same conditions, we'll have a crash further down the line when we invoke V8's original handler, but then we can be certain that the issue is somewhere in the lifecycle management of the isolate and not inside our handler.

Jira: PROF-13457

@szegedi szegedi added the semver-patch Bug or security fixes, mainly label Jan 15, 2026
@github-actions
Copy link

Overall package size

Self size: 1.77 MB
Deduped: 2.15 MB
No deduping: 2.15 MB

Dependency sizes | name | version | self size | total size | |------|---------|-----------|------------| | source-map | 0.7.6 | 185.63 kB | 185.63 kB | | pprof-format | 2.2.1 | 163.06 kB | 163.06 kB | | p-limit | 3.1.0 | 7.75 kB | 13.78 kB | | delay | 5.0.0 | 11.17 kB | 11.17 kB | | node-gyp-build | 3.9.0 | 8.81 kB | 8.81 kB |

🤖 This report was automatically generated by heaviest-objects-in-the-universe

@pr-commenter
Copy link

pr-commenter bot commented Jan 15, 2026

Benchmarks

Benchmark execution time: 2026-01-15 08:35:27

Comparing candidate commit 3dcf6f9 in PR branch szegedi/crash-on-dead with baseline commit 346a336 in branch main.

Found 0 performance improvements and 0 performance regressions! Performance is the same for 90 metrics, 30 unstable metrics.

}
auto isolate = Isolate::GetCurrent();
if (!isolate || isolate->IsDead()) {
if (!isolate) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like a race cleaning up / moving the isolate.
I'm not sure that removing the IsDead will not just move this to the next line.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isolate doesn't move in memory, it's part of the V8 core and not an object on the JavaScript heap.

Next line is a lookup in our isolate->profiler map. If we already removed the isolate binding from the map, then it'll not find a profiler, and just delegate to the V8 handler. If it crashes in there, at least we know the issue would most likely persist even if someone used only the Node.js built-in profiler. So I'm not saying we'll eliminate the crash here, but we'll move it out of Datadog code.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK to try this, we might learn something from the newer crash location.

Copy link

@r1viollet r1viollet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@szegedi szegedi merged commit 947f5cf into main Jan 15, 2026
171 of 182 checks passed
@szegedi szegedi deleted the szegedi/crash-on-dead branch January 15, 2026 10:35
szegedi added a commit that referenced this pull request Jan 15, 2026
@szegedi szegedi mentioned this pull request Jan 15, 2026
szegedi added a commit that referenced this pull request Jan 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

semver-patch Bug or security fixes, mainly

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants