Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
zen0wu opened this issue Aug 24, 2020 · 1 comment
Labels
invalid Issues and PRs that are invalid.

Comments

@zen0wu
Copy link

zen0wu commented Aug 24, 2020

  • 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.

@bnoordhuis
Copy link
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.

@bnoordhuis bnoordhuis added the invalid Issues and PRs that are invalid. label Sep 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
invalid Issues and PRs that are invalid.
Projects
None yet
Development

No branches or pull requests

2 participants