Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

questions for the V8 team #118

Closed
refack opened this issue May 2, 2017 · 14 comments
Closed

questions for the V8 team #118

refack opened this issue May 2, 2017 · 14 comments

Comments

@refack
Copy link

refack commented May 2, 2017

I wanted to ask the @v8 and @nodejs/v8 people couple few questions:

  1. source map callback (Consider minifying JS sources? node#12471, Support for source maps node#6471) can we have a "source map" resolution callback on creation of a stack trace?
  2. Promise and post-mortem (promises and post-mortem debugging post-mortem#16) is there a way to help the post-mortem scenario in V8. Something like hanging the call-stack on the promise chain just for the case of an unhandled rejection?

Thank you.

/cc @nodejs/post-mortem @nodejs/diagnostics

@jeisinger
Copy link

could you clarify what you mean by code map? From the referenced issues, I guess you mean source maps?

In general, we don't expose the source map to Javascript, but only use it over the inspector protocol. The inspector, however, should already use the source map when available for all stacks. Some for tracking the async stacks on promises.

@refack
Copy link
Author

refack commented May 2, 2017

So in both cases the issue at hand is error handling, either stack traces or post-mortem.

could you clarify what you mean by code map? From the referenced issues, I guess you mean source maps?

Yes, source-maps of course 🤦
The use case is stack-traces: In nodejs/node#12471 @hashseed suggested exposing a callback that will be triggered when a stack trace is created, so we (the embedder) can lookup the a source-map if needed.

Some for tracking the async stacks on promises.

For promises the use-case is post-mortem: even when we trigger a core-dump after an unhandled promise rejection, most of the interesting stacks have already unwound. In nodejs/post-mortem#16 there is a discussion on how to overcome this, but IMHO the most natural solution would be for the VM to give us the tools to create a more helpfull core-dump.

@benjamingr
Copy link
Member

@refack I think this is a good initiative - but if we want V8 folk to take a look at all these we should probably ask questions that are a lot less abstract.

@benjamingr
Copy link
Member

Also, I think perhaps scheduling a hangout with @nodejs/v8 about the post-mortem case could be beneficial regardless.

@refack refack changed the title questions to the V8 team questions for the V8 team May 4, 2017
@benjamingr
Copy link
Member

If I can add - Is it possible to take a copy-on-write core dump with V8? If so, how fast is it?

@bmeck
Copy link
Member

bmeck commented May 4, 2017

@benjamingr thats more an OS question

@refack
Copy link
Author

refack commented May 4, 2017

are a lot less abstract.

Ok, I'll write specific use cases...

@refack refack self-assigned this May 4, 2017
@hashseed
Copy link
Member

hashseed commented May 5, 2017

re 2). V8's debugger already goes great lengths to predict at reject or throw site whether an unhandled promise rejection will occur, while the stack is still available. This has some false positives though since the prediction cannot be perfect.

@refack
Copy link
Author

refack commented May 5, 2017

re 2). V8's debugger already goes great lengths to predict at reject or throw site whether an unhandled promise rejection will occur, while the stack is still available. This has some false positives though since the prediction cannot be perfect.

Thank you for the answer @hashseed !
False positives are not so bad (for post-mortem). Do you know at which version this entered?

@hashseed
Copy link
Member

hashseed commented May 5, 2017

Async/await had this from the start. You need to enable the debugger and enable break on uncaught exception to trigger debug break events.

@refack
Copy link
Author

refack commented May 5, 2017

Async/await had this from the start. You need to enable the debugger and enable break on uncaught exception to trigger debug break events.

👍 That is way nodejs/post-mortem promote aysnc/await over promises.
In this case I was referring to a post-mortem core dump. If the stacks are still there when node crashes we should be able to post-mortem the Promise chain.

@benjamingr
Copy link
Member

Is there any way to get the async stack (not trace) of a function in V8 without attaching a debugger?

@bmeck
Copy link
Member

bmeck commented May 5, 2017

@refack kind of, try/catch is static and can't be bound late so await has different timing from that perspective; therefore, knowing if it is unhandled is a sync operation.

@Trott
Copy link
Member

Trott commented Sep 8, 2017

This issue has been inactive for a while and this repository is now obsolete. I'm going to close this, but feel free to open another issue in a relevant active repository (TSC perhaps?) and include a link back to this issue if this is a subject that should receive continued attention.

@Trott Trott closed this as completed Sep 8, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants