File tree Expand file tree Collapse file tree 2 files changed +11
-4
lines changed Expand file tree Collapse file tree 2 files changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -291,6 +291,9 @@ void SignalHandler::HandleProfilerSignal(int sig,
291
291
return ;
292
292
}
293
293
auto isolate = Isolate::GetCurrent ();
294
+ if (!isolate || isolate->IsDead ()) {
295
+ return ;
296
+ }
294
297
WallProfiler* prof = g_profilers.GetProfiler (isolate);
295
298
296
299
if (!prof) {
Original file line number Diff line number Diff line change @@ -155,14 +155,18 @@ class WallProfiler : public Nan::ObjectWrap {
155
155
int64_t GetAsyncId (v8::Isolate* isolate) const {
156
156
if (gcCount > 0 ) {
157
157
return gcAsyncId;
158
+ } else if (isolate->InContext ()) {
159
+ return static_cast <int64_t >(node::AsyncHooksGetExecutionAsyncId (isolate));
158
160
}
159
- return static_cast < int64_t >( node::AsyncHooksGetExecutionAsyncId (isolate)) ;
161
+ return - 1 ;
160
162
}
161
163
162
164
void OnGCStart (v8::Isolate* isolate) {
163
- if (gcCount++ == 0 ) {
164
- gcAsyncId =
165
- static_cast <int64_t >(node::AsyncHooksGetExecutionAsyncId (isolate));
165
+ if (gcCount == 0 ) {
166
+ gcAsyncId = GetAsyncId (isolate);
167
+ gcCount = 1 ;
168
+ } else {
169
+ ++gcCount;
166
170
}
167
171
}
168
172
You can’t perform that action at this time.
0 commit comments