From 6587915185ad637c207aa2a197d41cae8ae63f88 Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Thu, 3 Oct 2019 17:59:06 +0200 Subject: [PATCH 1/3] =?UTF-8?q?src:=20fix=20BaseObject=20Detach=20for=20GC?= =?UTF-8?q?=E2=80=99ed=20objects?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This fixes a crash in test/sequential/test-performance-eventloopdelay.js. This should be squashed into > src: introduce custom smart pointers for `BaseObject`s --- src/base_object-inl.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/base_object-inl.h b/src/base_object-inl.h index af0a7d707b..f35cd6734e 100644 --- a/src/base_object-inl.h +++ b/src/base_object-inl.h @@ -187,7 +187,7 @@ void BaseObject::decrease_refcount() { if (new_refcount == 0) { if (metadata->is_detached) { delete this; - } else if (metadata->wants_weak_jsobj) { + } else if (metadata->wants_weak_jsobj && !persistent_handle_.IsEmpty()) { MakeWeak(); } } @@ -195,7 +195,7 @@ void BaseObject::decrease_refcount() { void BaseObject::increase_refcount() { unsigned int prev_refcount = pointer_data()->strong_ptr_count++; - if (prev_refcount == 0) + if (prev_refcount == 0 && !persistent_handle_.IsEmpty()) persistent_handle_.ClearWeak(); } From 9e9f2721190b6b483c9ba34c9c2872ea59b2edfb Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Thu, 3 Oct 2019 18:41:24 +0200 Subject: [PATCH 2/3] lib: fix typo in stream_base_commons.js Introduced in aa99a6ada86b96ff. --- lib/internal/stream_base_commons.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/internal/stream_base_commons.js b/lib/internal/stream_base_commons.js index c96da58ba1..917acd5c27 100644 --- a/lib/internal/stream_base_commons.js +++ b/lib/internal/stream_base_commons.js @@ -149,7 +149,7 @@ function afterWriteDispatched(self, req, err) { if (err !== 0) return self.destroy( errnoException(err, 'write', req.error), - req.callback()); + req.callback); if (!req.async && typeof req.callback === 'function') { req.callback(); From 1d74aa2e27c2cf19d639dd8289e756e91dc80357 Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Thu, 3 Oct 2019 19:32:15 +0200 Subject: [PATCH 3/3] test: fix test-process-versions for QUIC --- test/parallel/test-process-versions.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/test/parallel/test-process-versions.js b/test/parallel/test-process-versions.js index 194704f9e1..f0aac8deda 100644 --- a/test/parallel/test-process-versions.js +++ b/test/parallel/test-process-versions.js @@ -11,14 +11,12 @@ const expected_keys = [ 'v8', 'zlib', 'nghttp2', - 'nghttp3', 'napi', 'llhttp' ]; if (common.hasCrypto) { expected_keys.push('openssl'); - expected_keys.push('ngtcp2'); } if (common.hasIntl) { @@ -28,6 +26,11 @@ if (common.hasIntl) { expected_keys.push('unicode'); } +if (common.hasQuic) { + expected_keys.push('ngtcp2'); + expected_keys.push('nghttp3'); +} + expected_keys.sort(); const actual_keys = Object.keys(process.versions).sort();