src: dispose of V8 platform in `process.exit()` · MylesBorins/node@25ca9f1 · GitHub
Skip to content

Commit 25ca9f1

Browse files
addaleaxBethGriggs
authored andcommitted
src: dispose of V8 platform in process.exit()
Calling `process.exit()` calls the C `exit()` function, which in turn calls the destructors of static C++ objects. This can lead to race conditions with other concurrently executing threads; disposing of all Worker threads and then the V8 platform instance helps with this (although it might not be a full solution for all problems of this kind). Refs: nodejs#24403 Refs: nodejs#25007 PR-URL: nodejs#25061 Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
1 parent b9188d4 commit 25ca9f1

3 files changed

Lines changed: 11 additions & 2 deletions

File tree

src/env.cc

Lines changed: 5 additions & 2 deletions

src/node.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -383,6 +383,10 @@ static struct {
383383
#endif // !NODE_USE_V8_PLATFORM || !HAVE_INSPECTOR
384384
} v8_platform;
385385

386+
void DisposePlatform() {
387+
v8_platform.Dispose();
388+
}
389+
386390
#ifdef __POSIX__
387391
static const unsigned kMaxSignal = 32;
388392
#endif

src/node_internals.h

Lines changed: 2 additions & 0 deletions

0 commit comments

Comments
 (0)