profile
viewpoint

Ask questionsNode crashes when writing data on HTTP2 stream that meanwhile terminates

  • Version: v8.12.0
  • Platform: OSX, Darwin mymac.local 17.7.0 Darwin Kernel Version 17.7.0: Thu Jun 21 22:53:14 PDT 2018; root:xnu-4570.71.2~1/RELEASE_X86_64 x86_64
  • Subsystem: http2

When performing something along the lines of:

const http2Session = ...;
const outHeaders = { ... };
const req = http2Session.request({ ...outHeaders, [HTTP2_HEADER_PATH]: path });
const body: Buffer[] = [];
let headers: IncomingHttpHeaders = {};
req
      .on("response", (hs) => headers = hs)
      .on("data", (chunk) => body.push(chunk))
      .on("error", (error) => reject(error))
      .on("end", () => resolve({
        headers,
        status: parseInt(headers[HTTP2_HEADER_STATUS], 10),
        body: Buffer.concat(body),
      }));
req.end(Buffer.from("MYDATA"));

and the NGINX server becomes unavailable (shutsdown, GOAWAY, sessions close) sometimes we get the following error:

node[25931]: ../src/tls_wrap.cc:604:virtual int node::TLSWrap::DoWrite(node::WriteWrap *, uv_buf_t *, size_t, uv_stream_t *): Assertion `(ssl_) != (nullptr)' failed.
 1: node::Abort() [/Users/hbanken/.nvm/versions/node/v8.12.0/bin/node]
 2: node::(anonymous namespace)::DomainEnter(node::Environment*, v8::Local<v8::Object>) [/Users/hbanken/.nvm/versions/node/v8.12.0/bin/node]
 3: node::TLSWrap::DoWrite(node::WriteWrap*, uv_buf_t*, unsigned long, uv_stream_s*) [/Users/hbanken/.nvm/versions/node/v8.12.0/bin/node]
 4: node::http2::Http2Session::SendPendingData() [/Users/hbanken/.nvm/versions/node/v8.12.0/bin/node]
 5: node::http2::Http2Stream::RstStream(v8::FunctionCallbackInfo<v8::Value> const&) [/Users/hbanken/.nvm/versions/node/v8.12.0/bin/node]
 6: v8::internal::FunctionCallbackArguments::Call(void (*)(v8::FunctionCallbackInfo<v8::Value> const&)) [/Users/hbanken/.nvm/versions/node/v8.12.0/bin/node]
 7: v8::internal::MaybeHandle<v8::internal::Object> v8::internal::(anonymous namespace)::HandleApiCallHelper<false>(v8::internal::Isolate*, v8::internal::Handle<v8::internal::HeapObject>, v8::internal::Handle<v8::internal::HeapObject>, v8::internal::Handle<v8::internal::FunctionTemplateInfo>, v8::internal::Handle<v8::internal::Object>, v8::internal::BuiltinArguments) [/Users/hbanken/.nvm/versions/node/v8.12.0/bin/node]
 8: v8::internal::Builtin_Impl_HandleApiCall(v8::internal::BuiltinArguments, v8::internal::Isolate*) [/Users/hbanken/.nvm/versions/node/v8.12.0/bin/node]
 9: 0x3671961042fd
10: 0x3671961bd1d6

Expected behavior:

Native error is caught and converted in something NodeJS can handle instead of crashing the whole process.

nodejs/node

Answer questions addaleax

I’m closing this as v8.x is no longer supported … sorry if that wasn’t the outcome everyone was hoping for, but there aren’t going to be any more v8.x releases at this point.

useful!

Related questions

--max-http-header-size= is not allowed in NODE_OPTIONS
Crash with "req.handle.writev is not a function" on Socket.Writable.uncork hot 2
pkg-exports: "." errors without a specified `main` hot 2
shutdown ENOTCONN on TLS.Socket._final hot 2
HTTP/2 requests eventually start throwing NGHTTP2_ENHANCE_YOUR_CALM errors hot 2
Assertion `(parser->current_buffer_len_) == (0)' failed hot 1
Node.js 12.10 throwing EPROTO on HTTPS request hot 1
Remove util.inherits usage internally? hot 1
[Bug] Node 10.1.0 TLS issue with ldap: Client network socket disconnected before secure TLS connection was established hot 1
ReferenceError: internalBinding is not defined hot 1
Incorrect timezone hot 1
HPE_INVALID_HEADER_TOKEN on http requests hot 1
HPE_INVALID_HEADER_TOKEN on http requests hot 1
crypto, bad decrypt hot 1
stream.finished behaviour change hot 1
Github User Rank List