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

WIP async stack traces ... #2709

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions core/libdeno/api.cc
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,8 @@ void deno_init() {
// remove this to make it work asynchronously too. But that requires getting
// PumpMessageLoop and RunMicrotasks setup correctly.
// See https://github.com/denoland/deno/issues/2544
const char* argv[2] = {"", "--no-wasm-async-compilation"};
int argc = 2;
const char* argv[3] = {"", "--no-wasm-async-compilation", "--async-stack-traces"};
Copy link
Collaborator

@nayeemrmn nayeemrmn Aug 1, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think --async-stack-traces is on by default. All it's specified to do is enrich error.stack: https://v8.dev/docs/stack-trace-api#async-stack-traces (says it's off by default but that's changed I guess).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn’t seem to have an effect - I was just trying it

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think they have to be collected via other APIs 😢 see: nodejs/node#11865 (comment)

int argc = 3;
v8::V8::SetFlagsFromCommandLine(&argc, const_cast<char**>(argv), false);
}
}
Expand Down
6 changes: 6 additions & 0 deletions core/libdeno/binding.cc
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,12 @@ void PromiseRejectCallback(v8::PromiseRejectMessage promise_reject_message) {

v8::Context::Scope context_scope(context);

auto message = v8::Exception::CreateMessage(isolate, error);
auto stack_trace = message->GetStackTrace();
uint32_t count = static_cast<uint32_t>(stack_trace->GetFrameCount());
printf("FRAME COUNT %d\n", count);


int promise_id = promise->GetIdentityHash();
switch (promise_reject_message.GetEvent()) {
case v8::kPromiseRejectWithNoHandler:
Expand Down