Skip to content

dtrace ustack helper broken with turbofan #15010

@davidmarkclements

Description

@davidmarkclements
  • Version: 8.3.0, 8.4.0
  • Platform: macOs
  • Subsystem: tracing

Given a dtrace script:

#!/usr/sbin/dtrace -s

#pragma D option quiet
#pragma D option switchrate=1000hz

profile-1ms /pid == $target/ {
  /* Sampling every 1ms therefore also recording timestamp at ms resolution */
  printf("%s %d %d: %s:", execname, pid, timestamp / 1000000, probename);
  ustack(10000);
  printf("\n");
}

Profiling (ran with --perf-basic-prof):

const fs = require('fs')
setInterval(() => { x(()=>{
  fs.writeFileSync('/dev/null', 'ok')
}) }, 10)


function x (cb) {
  setTimeout(cb, 10, Math.round(Math.random()) ? null : Error(), {x: Math.random()})
}

On Node 8.3.0 or Node 8.4.0 we get the output (gist, too big):

https://gist.github.com/davidmarkclements/b4c7f1e4aba2b6a75340ff478f5585cb

Compare this with output on Node 8.2.1

https://gist.github.com/davidmarkclements/adee8d9a85193265d9c45be29f1b0ec8

And Node 6.11.2

https://gist.github.com/davidmarkclements/775c1cb48995beafa48c7878ec6b03c7

There are no hex addresses in the dtrace output for 8.3.0/8.4.0 which means JS frames
aren't being captured by the ustack helper (https://github.com/nodejs/node/blob/master/src/v8ustack.d)

This is likely to affect a variety of ecosystem (and proprietary/internal) tooling.

For me it's affecting http://npm.im/0x. The option to use --prof and using the tick processor isn't quite viable because we lose libuv stacks.

Here's a related discussion about this problem at davidmarkclements/0x#76

I've observed a similar problem on Linux, and suspect that the perf output is also incompatible with Turbofan but we need to verify.

cc @mcollina @davepacheco @hashseed

Metadata

Metadata

Assignees

No one assigned

    Labels

    v8 engineIssues and PRs related to the V8 dependency.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions