Repository navigation
Unref a socket raise v8 error #38707
Copy link
Copy link
Closed
Labels
confirmed-bugIssues and PRs for confirmed bugs.Issues and PRs for confirmed bugs.tlsIssues and PRs related to the tls subsystem.Issues and PRs related to the tls subsystem.
Description
Activity
- addedconfirmed-bugIssues and PRs for confirmed bugs.Issues and PRs for confirmed bugs.tlsIssues and PRs related to the tls subsystem.Issues and PRs related to the tls subsystem.
on May 17, 2021 /cc @nodejs/net
I can reproduce with Node.js 16.1.0Debug backtrace on 75340f3:
#0 0x00007ffff6cf683f in raise () from /lib64/libc.so.6 #1 0x00007ffff6ce0c95 in abort () from /lib64/libc.so.6 #2 0x000000000116a0ee in node::Abort () at ../../src/node_errors.cc:254 #3 0x000000000116af3e in node::OnFatalError (location=0x3673e18 "v8::HandleScope::CreateHandle()", message=0x3673de8 "Cannot create a handle without a HandleScope") at ../../src/node_errors.cc:441 #4 0x00000000013e6751 in v8::Utils::ReportApiFailure (location=location@entry=0x3673e18 "v8::HandleScope::CreateHandle()", message=message@entry=0x3673de8 "Cannot create a handle without a HandleScope") at ../../deps/v8/src/api/api.cc:279 #5 0x0000000001683f91 in v8::Utils::ApiCheck (message=0x3673de8 "Cannot create a handle without a HandleScope", location=0x3673e18 "v8::HandleScope::CreateHandle()", condition=<optimized out>) at ../../deps/v8/src/api/api.h:144 #6 v8::internal::HandleScope::Extend (isolate=isolate@entry=0x6079390) at ../../deps/v8/src/handles/handles.cc:93 #7 0x00000000013c8028 in v8::internal::HandleScope::CreateHandle (value=58450354347249, isolate=0x6079390) at ../../deps/v8/src/handles/handles-inl.h:167 #8 v8::internal::HandleScope::GetHandle (isolate=isolate@entry=0x6079390, value=58450354347249) at ../../deps/v8/src/handles/handles-inl.h:185 #9 0x00000000016ac423 in v8::internal::HandleBase::HandleBase (isolate=0x6079390, object=<optimized out>, this=<optimized out>) at ../../deps/v8/src/handles/handles-inl.h:20 #10 v8::internal::Handle<v8::internal::SeqOneByteString>::Handle (isolate=0x6079390, object=..., this=<optimized out>) at ../../deps/v8/src/handles/handles-inl.h:52 #11 v8::internal::handle<v8::internal::SeqOneByteString> (isolate=0x6079390, object=...) at ../../deps/v8/src/handles/handles-inl.h:64 #12 v8::internal::FactoryBase<v8::internal::Factory>::NewRawOneByteString (this=this@entry=0x6079390, length=35, allocation=allocation@entry=v8::internal::AllocationType::kYoung) at ../../deps/v8/src/heap/factory-base.cc:545 #13 0x00000000016d83be in v8::internal::Factory::NewStringFromOneByte (this=this@entry=0x6079390, string=..., allocation=allocation@entry=v8::internal::AllocationType::kYoung) at /usr/include/c++/8/ext/new_allocator.h:86 #14 0x00000000013fdc75 in v8::(anonymous namespace)::NewString (string=..., type=v8::NewStringType::kNormal, factory=0x6079390) at ../../deps/v8/src/api/api.cc:6371 #15 v8::String::NewFromOneByte (isolate=0x6079390, data=0x35f4380 "Canceled because of SSL destruction", type=v8::NewStringType::kNormal, length=<optimized out>) at ../../deps/v8/src/api/api.cc:6429 #16 0x000000000102c2ba in node::OneByteString (isolate=0x6079390, data=0x35f4380 "Canceled because of SSL destruction", length=-1) at ../../src/util-inl.h:187 #17 0x0000000001100dc0 in node::StreamReq::Done (this=0x62d3330, status=-125, error_str=0x35f4380 "Canceled because of SSL destruction") at ../../src/stream_base-inl.h:284 #18 0x0000000001382318 in node::crypto::TLSWrap::InvokeQueued (this=0x62d4af0, status=-125, error_str=0x35f4380 "Canceled because of SSL destruction") at ../../src/crypto/crypto_tls.cc:379 #19 0x000000000138719c in node::crypto::TLSWrap::Destroy (this=0x62d4af0) at ../../src/crypto/crypto_tls.cc:1243 #20 0x0000000001381fec in node::crypto::TLSWrap::~TLSWrap (this=0x62d4af0, __in_chrg=<optimized out>) at ../../src/crypto/crypto_tls.cc:353 #21 0x00000000013820fa in node::crypto::TLSWrap::~TLSWrap (this=0x62d4af0, __in_chrg=<optimized out>) at ../../src/crypto/crypto_tls.cc:354 #22 0x00000000010c1cf4 in node::BaseObject::DeleteMe (data=0x62d4af0) at ../../src/env.cc:1685 #23 0x00000000010b1655 in node::Environment::RunCleanup (this=0x60f6c50) at ../../src/env.cc:701 #24 0x000000000102a4fd in node::FreeEnvironment (env=0x60f6c50) at ../../src/api/environment.cc:371 #25 0x000000000102727e in node::FunctionDeleter<node::Environment, &node::FreeEnvironment>::operator() (this=0x7fffffffde50, pointer=0x60f6c50) at ../../src/util.h:636 #26 0x0000000001026d31 in std::unique_ptr<node::Environment, node::FunctionDeleter<node::Environment, &node::FreeEnvironment> >::~unique_ptr (this=0x7fffffffde50, __in_chrg=<optimized out>) at /usr/include/c++/8/bits/unique_ptr.h:277 #27 0x00000000011d5f5f in node::NodeMainInstance::Run (this=0x7fffffffdef0, env_info=0x6003060 <node::env_info>) at ../../src/node_main_instance.cc:135 #28 0x00000000011118f6 in node::Start (argc=2, argv=0x7fffffffe168) at ../../src/node.cc:1083 #29 0x00000000029c59cd in main (argc=2, argv=0x7fffffffe168) at ../../src/node_main.cc:127Reacted by bransonWill this issue affect other
unrefAPIs?
And are there any workarounds? Currently, it seems like waiting a few milliseconds(like 40) is one way. But code like this is kind of confusing.- added a commit that references this issue
on May 18, 2021 - added a commit that references this issue
on May 31, 2021 - added a commit that references this issue
on May 22, 2026
Metadata
Metadata
Assignees
Labels
confirmed-bugIssues and PRs for confirmed bugs.Issues and PRs for confirmed bugs.tlsIssues and PRs related to the tls subsystem.Issues and PRs related to the tls subsystem.
What steps will reproduce the bug?
How often does it reproduce? Is there a required condition?
every time in
Node.js15.x and aboveWhat is the expected behavior?
the process should exit gracefully
What do you see instead?