Skip to content

Calling worker.terminate() while http/2 reads on a stream crashes the whole process with FATAL ERROR / SIGABRT #38418

Closed
@Prinzhorn

Description

@Prinzhorn
  • Version: 14.16.0
  • Platform: Ubuntu 20.04
  • Subsystem: Stream?
/node_modules/electron/dist/electron[56003]: ../../third_party/electron_node/src/stream_base.cc:351:MaybeLocal<v8::Value> node::StreamBase::CallJSOnreadMethod(ssize_t, Local<v8::ArrayBuffer>, size_t, node::StreamBase::StreamBaseJSChecks): Assertion `onread->IsFunction()' failed.
/node_modules/electron/dist/electron exited with signal SIGABRT

I'm sorry for not following the issue template. This just happened locally during development of an Electron 12.0.1 app which comes with Node 14.16.0. As far as I can tell Electron does not patch stream_base.cc so I assume this was a Node thing. Maybe this has already been fixed in a more recent Node release (edit: looks like 14.16.1 was only a security release), but I couldn't find anything.

Unfortunately I haven't been able to reproduce it again. I assume I ran into a race condition. I will try to track this down, but it's hard.

Here's what I do know:

  1. I'm running a worker thread
  2. Inside the worker thread I'm starting fastify and fastify-websocket
  3. The SIGABRT happened exactly the moment I hit enter in the UI, which triggered both an HTTP POST and a new WebSocket to said local server, but I don't know if any of these cause the issue with the stream. But I also don't think this was a coincidence.

I will try to put my race-condition helmet on and get on my Fuzzer and see if I can trigger this again. But maybe someone can point in a direction if this assertion should ever be able to fail due to a user error (e.g. a bug in http or fastify)? I'm not even sure what the onread is in this case but I think forgetting to set it in user land should not take down the whole process, should it?

Metadata

Metadata

Assignees

No one assigned

    Labels

    workerIssues and PRs related to Worker support.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions