src: split out async stack corruption detection from inline fn · nodejs/node@fe4158a · GitHub
Skip to content

Commit fe4158a

Browse files
addaleaxdanielleadams
authored andcommitted
src: split out async stack corruption detection from inline fn
This is fairly expensive code that unnecessarily bloats the contents of the inline function. PR-URL: #41331 Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Darshan Sen <raisinten@gmail.com>
1 parent 72921f4 commit fe4158a

3 files changed

Lines changed: 21 additions & 14 deletions

File tree

src/env-inl.h

Lines changed: 4 additions & 14 deletions

src/env.cc

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1196,6 +1196,21 @@ void AsyncHooks::grow_async_ids_stack() {
11961196
async_ids_stack_.GetJSArray()).Check();
11971197
}
11981198

1199+
void AsyncHooks::FailWithCorruptedAsyncStack(double expected_async_id) {
1200+
fprintf(stderr,
1201+
"Error: async hook stack has become corrupted ("
1202+
"actual: %.f, expected: %.f)\n",
1203+
async_id_fields_.GetValue(kExecutionAsyncId),
1204+
expected_async_id);
1205+
DumpBacktrace(stderr);
1206+
fflush(stderr);
1207+
if (!env()->abort_on_uncaught_exception())
1208+
exit(1);
1209+
fprintf(stderr, "\n");
1210+
fflush(stderr);
1211+
ABORT_NO_BACKTRACE();
1212+
}
1213+
11991214
void Environment::Exit(int exit_code) {
12001215
if (options()->trace_exit) {
12011216
HandleScope handle_scope(isolate());

src/env.h

Lines changed: 2 additions & 0 deletions

0 commit comments

Comments
 (0)