Glimpse / Home

Project Glimpse: Node Edition - Spend less time debugging and more time developing.
http://node.getglimpse.com
Other
252 stars 9 forks source link

[Stack] Errors parsing stack frames when using pretty-error module. #99

Open bonesoul opened 7 years ago

bonesoul commented 7 years ago

node 7.10.0 win10 - x64

my code; if (process.env.NODE_ENV !== 'production') { require('@glimpse/glimpse').init(); }

getting luts of errors like;

Glimpse (Error StackHelperUnsupportedStackFrameFormat): Unsupported stack frame format found:
Glimpse (Error StackHelperUnsupportedStackFrameFormat): Unsupported stack frame format found:    - Array.forEach
Glimpse (Error StackHelperUnsupportedStackFrameFormat): Unsupported stack frame format found:
Glimpse (Error StackHelperUnsupportedStackFrameFormat): Unsupported stack frame format found:    - application.js:217 Function.use
Glimpse (Error StackHelperUnsupportedStackFrameFormat): Unsupported stack frame format found:
Glimpse (Error StackHelperUnsupportedStackFrameFormat): Unsupported stack frame format found:    - server.js:110 Promise
Glimpse (Error StackHelperUnsupportedStackFrameFormat): Unsupported stack frame format found:
Glimpse (Error StackHelperUnsupportedStackFrameFormat): Unsupported stack frame format found:    - debuggability.js:300 Promise._execute
Glimpse (Error StackHelperUnsupportedStackFrameFormat): Unsupported stack frame format found:
Glimpse (Error StackHelperUnsupportedStackFrameFormat): Unsupported stack frame format found:    - promise.js:483 Promise._resolveFromExecutor
Glimpse (Error StackHelperUnsupportedStackFrameFormat): Unsupported stack frame format found:
Glimpse (Error StackHelperUnsupportedStackFrameFormat): Unsupported stack frame format found:    - promise.js:79 new Promise
Glimpse (Error StackHelperUnsupportedStackFrameFormat): Unsupported stack frame format found:
Glimpse (Error StackHelperUnsupportedStackFrameFormat): Unsupported stack frame format found:    - server.js:47 run
Glimpse (Error StackHelperUnsupportedStackFrameFormat): Unsupported stack frame format found:
Glimpse (Error StackHelperUnsupportedStackFrameFormat): Unsupported stack frame format found:    - app.js:100 startup
Glimpse (Error StackHelperUnsupportedStackFrameFormat): Unsupported stack frame format found:
Glimpse (Error StackHelperUnsupportedStackFrameFormat): Unsupported stack frame format found:    - next_tick.js:109 process._tickCallback
Glimpse (Error StackHelperUnsupportedStackFrameFormat): Unsupported stack frame format found:
Glimpse (Error StackHelperUnsupportedStackFrameFormat): Unsupported stack frame format found:
Glimpse (Error StackHelperUnsupportedStackFrameFormat): Unsupported stack frame format found:
Glimpse (Error StackHelperUnsupportedStackFrameFormat): Unsupported stack frame format found:    - application.js:220 Function.<anonymous>
Glimpse (Error StackHelperUnsupportedStackFrameFormat): Unsupported stack frame format found:
Glimpse (Error StackHelperUnsupportedStackFrameFormat): Unsupported stack frame format found:    - Array.forEach
Glimpse (Error StackHelperUnsupportedStackFrameFormat): Unsupported stack frame format found:
Glimpse (Error StackHelperUnsupportedStackFrameFormat): Unsupported stack frame format found:    - application.js:217 Function.use
Glimpse (Error StackHelperUnsupportedStackFrameFormat): Unsupported stack frame format found:
Glimpse (Error StackHelperUnsupportedStackFrameFormat): Unsupported stack frame format found:    - server.js:129 Promise
Glimpse (Error StackHelperUnsupportedStackFrameFormat): Unsupported stack frame format found:
Glimpse (Error StackHelperUnsupportedStackFrameFormat): Unsupported stack frame format found:    - debuggability.js:300 Promise._execute
Glimpse (Error StackHelperUnsupportedStackFrameFormat): Unsupported stack frame format found:
Glimpse (Error StackHelperUnsupportedStackFrameFormat): Unsupported stack frame format found:    - promise.js:483 Promise._resolveFromExecutor
Glimpse (Error StackHelperUnsupportedStackFrameFormat): Unsupported stack frame format found:
Glimpse (Error StackHelperUnsupportedStackFrameFormat): Unsupported stack frame format found:    - promise.js:79 new Promise
Glimpse (Error StackHelperUnsupportedStackFrameFormat): Unsupported stack frame format found:
Glimpse (Error StackHelperUnsupportedStackFrameFormat): Unsupported stack frame format found:    - server.js:47 run
Glimpse (Error StackHelperUnsupportedStackFrameFormat): Unsupported stack frame format found:
Glimpse (Error StackHelperUnsupportedStackFrameFormat): Unsupported stack frame format found:    - app.js:100 startup
Glimpse (Error StackHelperUnsupportedStackFrameFormat): Unsupported stack frame format found:
Glimpse (Error StackHelperUnsupportedStackFrameFormat): Unsupported stack frame format found:    - next_tick.js:109 process._tickCallback
Glimpse (Error StackHelperUnsupportedStackFrameFormat): Unsupported stack frame format found:
mike-kaufman commented 7 years ago

Thanks for reporting this @bonesoul. We'll take a look and hopefully get a fix quickly. Note that while this looks like a lot of errors, Glimpse should still be working, the only thing impacted is our ability to display source code locations where certain events occur (e.g., where middleware is registered, where log statements are made, or where http client calls occur)

bonesoul commented 7 years ago

i can't get glimpse working as the huge amount of errors slows down my application, i can not even boot it.

mike-kaufman commented 7 years ago

sorry to hear that. :(. Is your application public by chance so that I can take a look?

bonesoul commented 7 years ago

it's a private repository but i can help you with the information you need.

mike-kaufman commented 7 years ago

Thanks @bonesoul. I don't understand why your stack frames are formatted as - next_tick.js:109 process._tickCallback. Are you using some library that changes the format of stacks?

When I run this code in win 10/node 7.10.0:

process.nextTick(() => {
    func = () => {
        const e = new Error();
        console.log(e.stack);
    };
    const a = [func];
    a.forEach((f) => {
        f();
    });
});

I see this output:

Error
    at func (d:\tutorials\nodejs\stack\app.js:5:19)
    at a.forEach (d:\tutorials\nodejs\stack\app.js:10:9)
    at Array.forEach (native)
    at process.nextTick (d:\tutorials\nodejs\stack\app.js:9:7)
    at _combinedTickCallback (internal/process/next_tick.js:73:7)
    at process._tickCallback (internal/process/next_tick.js:104:9)
    at Module.runMain (module.js:607:11)
    at run (bootstrap_node.js:427:7)
    at startup (bootstrap_node.js:151:9)
    at bootstrap_node.js:542:3

which is very different from the stack frames reported in those error messages.

Can you send me the output on your machine from above code?

mike-kaufman commented 7 years ago

Hi @bonesoul -

Could you answer these questions for me?

  1. Are you using any packages that change the format of stack frames?
  2. Can you send me the output from the following code:
process.nextTick(() => {
    func = () => {
        const e = new Error();
        console.log(e.stack);
    };
    const a = [func];
    a.forEach((f) => {
        f();
    });
});
bonesoul commented 7 years ago
  Error:

  - app.js:107 func
    D:/source/vapingdb/src/app.js:107:19

  - app.js:112 a.forEach
    D:/source/vapingdb/src/app.js:112:9

  - Array.forEach

  - app.js:111 process.nextTick
    D:/source/vapingdb/src/app.js:111:9

  - async-track.js:293 wrappedCallback
    [vapingdb]/[@glimpse]/glimpse-agent-node/release/async-track/async-track.js:293:33

  - next_tick.js:73 _combinedTickCallback
    internal/process/next_tick.js:73:7

  - next_tick.js:104 Immediate._tickCallback
    internal/process/next_tick.js:104:9

  - timers.js:672 runCallback
    timers.js:672:20

  - timers.js:645 tryOnImmediate
    timers.js:645:5

  - timers.js:617 processImmediate [as _immediateCallback]
    timers.js:617:5
avanderhoorn commented 7 years ago

Just wondering, are you using any packages that change the format of stack frames?

bonesoul commented 7 years ago

i'm not aware of any that makes changes, but i'm aware of ones that watch it actually, but they are already disabled;

risingstack/trace: "3.10.0", "opbeat": "4.13.1",

additinoally i've packages that may depend on stack;

"debug": "2.6.6", "http-errors": "1.6.1", "pretty-error": "2.1.0",

i'll be disabling them to see the outcome.

bonesoul commented 7 years ago

found it; https://github.com/AriaMinaei/pretty-error is the offending package.

mike-kaufman commented 7 years ago

Thanks @bonesoul. Given the usage of pretty-error, we'll look into supporting parsing stack frame format produced by pretty-error. Stay tuned. Until we get support in, you could remove pretty-error & you shouldn't see those error messages any longer.

Also, we should have an update out today that will chagne our error reporting logic such that we'll only emit an error message once per unsupported frame, so this should limit the noise here.

mike-kaufman commented 7 years ago

OK, v0.20.9 is now available on NPM. This will limit the number of errors we output when we can't parse certain stacks, so your app should be usable even if you include pretty-error.

bonesoul commented 7 years ago

great i'll give it a try