Skip to content

Diagnostic report does not report javascriptStack - making it essentially useless #34896

Description

@zen0wu
  • Version: 12.18.3
  • Platform: macOS and Linux
  • Subsystem:

What steps will reproduce the bug?

Here's a sample program I wrote to repro the issue.

function sleep(ms) {
	return new Promise(res => setTimeout(res, ms))
}

async function h() {
	for (let i = 0; i < 10000; i++) {
		try {
			throw new Error("BAH")
		} catch (e) {
			await sleep(6)
		}
	}
}

async function g() {
	await h()
}

async function f() {
	await g()
}

f()

Running this with

node --experimental-report --report-on-signal test.js &
# and then
kill -USR2 <PID>

View the report file.

How often does it reproduce? Is there a required condition?

Reproduce every time.

What is the expected behavior?

I tested the same program with Node 10 + node-report. A stack trace is reported.

==== JavaScript Stack Trace ====================================================

JavaScript VM state: <unknown>

 0: [pc=0x1dedf9ce74b3] sleep (/Users/zeno/Developer/tmp/node/diag.js:1:77)
 1: [pc=0x1dedf9ce7071] h (/Users/zeno/Developer/tmp/node/diag.js:10:10)

What do you see instead?

"javascriptStack": {
    "message": "No stack.",
    "stack": [
      "Unavailable."
    ],
    "errorProperties": {
    }
  }

Additional information

Note that this is not a consistent behavior - sometimes node 10 also reports No stack trace, but I've repeatedly tested Node 12 and no stack trace is reported, ever (after about seeing 40 reports). This is definitely a better way to reproduce this, but I do believe there's a pattern here. The example above is for demonstration purpose. This also applies with a real world express application.

Without the javascriptStack, it renders the diagnostic report useless - Basically all other info can be obtained easily and not as useful for debugging.

Let me know if any further info is needed. I believe this is a high-pri breakage on a major feature.

Activity

  1. bnoordhuis commented on Sep 8, 2020

    @bnoordhuis
    Member

    That's the expected behavior if you send the signal when it's waiting for the timer to expire because at that point there is indeed no JS stack trace - control has returned to the event loop and Node.js suspends itself until the timer expires.

    I can go into more detail if it's still unclear to you but I'm closing this as not-a-bug.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    invalidIssues and PRs that are invalid.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions