File tree Expand file tree Collapse file tree 2 files changed +10
-0
lines changed Expand file tree Collapse file tree 2 files changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -231,6 +231,10 @@ void IsolateBase::jsgGetMemoryInfo(MemoryTracker& tracker) const {
231231
232232void IsolateBase::deferDestruction (Item item) {
233233 KJ_REQUIRE_NONNULL (ptr, " tried to defer destruction after V8 isolate was destroyed" );
234+ if (queueState != QueueState::ACTIVE) {
235+ KJ_LOG (ERROR, " tried to defer destruction during isolate shutdown" , queueState,
236+ kj::getStackTrace ());
237+ }
234238 queue.lockExclusive ()->push (kj::mv (item));
235239}
236240
@@ -458,6 +462,8 @@ v8::Local<v8::FunctionTemplate> IsolateBase::getOpaqueTemplate(v8::Isolate* isol
458462}
459463
460464void IsolateBase::dropWrappers (kj::FunctionParam<void ()> drop) {
465+ KJ_REQUIRE (queueState == QueueState::ACTIVE);
466+ queueState = QueueState::DROPPING;
461467 // Delete all wrappers.
462468 jsg::runInV8Stack ([&](jsg::V8StackScope& stackScope) {
463469 v8::Locker lock (ptr);
@@ -480,6 +486,7 @@ void IsolateBase::dropWrappers(kj::FunctionParam<void()> drop) {
480486
481487 // Destroy all wrappers.
482488 heapTracer.clearWrappers ();
489+ queueState = QueueState::DROPPED;
483490 });
484491}
485492
Original file line number Diff line number Diff line change @@ -365,6 +365,9 @@ class IsolateBase {
365365 const kj::MutexGuarded<BatchQueue<Item>> queue{
366366 DESTRUCTION_QUEUE_INITIAL_SIZE, DESTRUCTION_QUEUE_MAX_CAPACITY};
367367
368+ enum QueueState { ACTIVE, DROPPING, DROPPED };
369+ QueueState queueState = ACTIVE;
370+
368371 struct CodeBlockInfo {
369372 size_t size = 0 ;
370373 kj::Maybe<v8::JitCodeEvent::CodeType> type;
You can’t perform that action at this time.
0 commit comments