question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Debugging with async stack traces in Node.js

See original GitHub issue

The commit d37d0fff, which fixed #542, modified Bluebird to detect when it’s running in a Chrome/Blink DevTools debugger and use a different queueing mechanism that plays well with DevTools “async stack traces” feature.

AFAICT, this does not work in DevTools provided by Node.js built-in debugger (node --inspect):

  • bluebird@3.5.0
  • node@6.10.1 (but also 8.0.0-pre compiled locally from nodejs/node@e1d4f0ed)

It would be great to modify Bluebird to support async stack traces in Node.js too. I think this will most likely require changes in Node.js too - AFAICT, right now there is no way how to detect whether a debugger is running or not.

A sample app I am using to reproduce the problem.

'use strict';

const Promise = require('bluebird');

setInterval(tick, 500);

function tick() {
  tickAsync().then(
    success => console.log('PASS', success),
    error => console.log('FAIL', error)
  );
}

function tickAsync() {
  return first().then(second).then(() => {
    debugger;
    return 'ok';
  });
}

function first() {
  return delay(10).then(() => {
    console.log('first done');
  });
}

function second() {
  return delay(10).then(() => {
    console.log('second done');
  });
}

function delay(ms) {
  // originally, I used setTimeout(resolve, ms)
  // but it looks like setTimeout is breaking 
  // V8's async-stack-trace detection :(
  return new Promise(resolve => resolve());
}

Async stack trace when using bluebird:

screen shot 2017-03-25 at 15 16 31

Async stack trace when I comment-out const Promise = require('bluebird'):

screen shot 2017-03-25 at 15 15 25

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:9

github_iconTop GitHub Comments

2reactions
bajtoscommented, Mar 15, 2019

Need help how to solve this : (node:740) [INSPECTOR_ASYNC_STACK_TRACES_NOT_AVAILABLE] Warning: Warning: Async stack traces in debugger are not available on 32bit platforms. The feature is disabled.

This is off-topic here.

Async stack traces are no supported on 32bit platforms because of a limitation of V8 inspector/debugger. See the discussion in https://github.com/nodejs/node/pull/13870, especially the following threads: https://github.com/nodejs/node/pull/13870#discussion_r124930411, https://github.com/nodejs/node/pull/13870#discussion_r127086782, https://github.com/nodejs/node/pull/13870#issuecomment-315126472.

https://github.com/nodejs/node is the place where to discuss this issue further.

0reactions
Serha31commented, Mar 13, 2019

Need help how to solve this : (node:740) [INSPECTOR_ASYNC_STACK_TRACES_NOT_AVAILABLE] Warning: Warning: Async stack traces in debugger are not available on 32bit platforms. The feature is disabled.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Async Stack Traces in Node.js 12 | www.thecodebarbarian.com
Consider the below code. An async function run() calls another async function bar() , and bar() throws an error. What does the stack...
Read more >
Incomplete async stack traces in Node.js 14.15.0 · Issue #36126
Based on the documentation I would assume that Node.js 14 does now support stack traces in async code but unfortunately node only generates ......
Read more >
Debugging async operations in Node.js - LogRocket Blog
The function startTracking commences tracking of asynchronous operations. Here we pass in the doTimeout function. The async debugger invokes ...
Read more >
Useful async stack traces in Node.js 14
Such a stack trace should make debugging a breeze, but, unfortunately, I have found this to work very poorly. Consider the following program:...
Read more >
Debugging async code - Delicious Screencasts
Classic or "long" (async) stack traces? When your async code goes haywire, the first thing you'll likely want to zero in on is...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found