Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Undici throws a V8 error with node 12.19.0 #448

Closed
pantharshit00 opened this issue Oct 7, 2020 · 7 comments
Closed

Undici throws a V8 error with node 12.19.0 #448

pantharshit00 opened this issue Oct 7, 2020 · 7 comments

Comments

@pantharshit00
Copy link

pantharshit00 commented Oct 7, 2020

Undici 2.0.5 is throwing a V8 stack trace when used with node version 12.19.0

node[28363]: ../src/node_http_parser_impl.h:529:static void node::(anonymous namespace)::Parser::Initialize(const FunctionCallbackInfo<v8::Value> &): Assertion `args[3]->IsInt32()' failed.
 1: 0x1011f40c5 node::Abort() (.cold.1) [/Users/harshit/.nvm/versions/node/v12.19.0/bin/node]
 2: 0x1000a5749 node::Abort() [/Users/harshit/.nvm/versions/node/v12.19.0/bin/node]
 3: 0x1000a55b1 node::Assert(node::AssertionInfo const&) [/Users/harshit/.nvm/versions/node/v12.19.0/bin/node]
 4: 0x1000c6e1b node::(anonymous namespace)::Parser::Initialize(v8::FunctionCallbackInfo<v8::Value> const&) [/Users/harshit/.nvm/versions/node/v12.19.0/bin/node]
 5: 0x100259838 v8::internal::FunctionCallbackArguments::Call(v8::internal::CallHandlerInfo) [/Users/harshit/.nvm/versions/node/v12.19.0/bin/node]
 6: 0x100258df9 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/harshit/.nvm/versions/node/v12.19.0/bin/node]
 7: 0x100258562 v8::internal::Builtin_Impl_HandleApiCall(v8::internal::BuiltinArguments, v8::internal::Isolate*) [/Users/harshit/.nvm/versions/node/v12.19.0/bin/node]
 8: 0x100a02b19 Builtins_CEntry_Return1_DontSaveFPRegs_ArgvOnStack_BuiltinExit [/Users/harshit/.nvm/versions/node/v12.19.0/bin/node]
 9: 0x1009882a4 Builtins_InterpreterEntryTrampoline [/Users/harshit/.nvm/versions/node/v12.19.0/bin/node]
[1]    28363 abort      node index.js

The above error doesn't happen with node 12.18.4 or 14.13.0. Node 12.19 was released on Oct 6. I think this is related to use of native http_parser from node via process.binding:

const { HTTPParser } = process.binding('http_parser') // eslint-disable-line

Reproduction

// server.js
"use strict";

const { createServer } = require("http");

createServer((req, res) => {
  res.end("hello world");
}).listen("/var/tmp/undici.sock");
// client.js
const { Client } = require("undici");
const { Writable } = require("stream");

const client = new Client(`http://localhost`, {
  socketPath: "/var/tmp/undici.sock",
});

client
  .request({
    path: "/",
    method: "GET",
  })
  .then(({ body }) => {
    body.pipe(
      new Writable({
        write(_, __, callback) {
          callback();
        },
      })
    );
  });

Run server.js and then run client.js to reproduce.

Additional Context

This is issue from our tracker which we were trying to investigate and found this: prisma/prisma-client-js#907

ronag added a commit that referenced this issue Oct 7, 2020
ronag added a commit that referenced this issue Oct 7, 2020
@ronag ronag closed this as completed in 6c2da70 Oct 7, 2020
@Jolg42
Copy link

Jolg42 commented Oct 7, 2020

💚 Many thanks! That was super fast @ronag

@Jolg42
Copy link

Jolg42 commented Oct 7, 2020

@ronag Do you plan to release a new version to npm in the next days maybe?

@ronag
Copy link
Member

ronag commented Oct 7, 2020

@Jolg42 later today

@ronag
Copy link
Member

ronag commented Oct 7, 2020

@Jolg42 published

@pantharshit00
Copy link
Author

Hmm, @ronag I am still able to reproduce the error in 2.0.6:
image

╭─     ~/code/reproductions/issue-test-herko/undici-reproduction              ✔  12.19.0    2.71G   ─╮
╰─ cat node_modules/undici/package.json | rg 2.0.6                                                             ─╯
  "_from": "undici@2.0.6",
  "_id": "undici@2.0.6",
    "raw": "undici@2.0.6",
    "rawSpec": "2.0.6",
    "fetchSpec": "2.0.6"
  "_resolved": "https://registry.npmjs.org/undici/-/undici-2.0.6.tgz",
  "_spec": "undici@2.0.6",
  "version": "2.0.6"

╭─     ~/code/reproductions/issue-test-herko/undici-reproduction              ✔  12.19.0    2.71G   ─╮
╰─ node index.js                                                                                               ─╯
node[3226]: ../src/node_http_parser_impl.h:529:static void node::(anonymous namespace)::Parser::Initialize(const FunctionCallbackInfo<v8::Value> &): Assertion `args[3]->IsInt32()' failed.
 1: 0x1011f40c5 node::Abort() (.cold.1) [/Users/harshit/.nvm/versions/node/v12.19.0/bin/node]
 2: 0x1000a5749 node::Abort() [/Users/harshit/.nvm/versions/node/v12.19.0/bin/node]
 3: 0x1000a55b1 node::Assert(node::AssertionInfo const&) [/Users/harshit/.nvm/versions/node/v12.19.0/bin/node]
 4: 0x1000c6e1b node::(anonymous namespace)::Parser::Initialize(v8::FunctionCallbackInfo<v8::Value> const&) [/Users/harshit/.nvm/versions/node/v12.19.0/bin/node]
 5: 0x100259838 v8::internal::FunctionCallbackArguments::Call(v8::internal::CallHandlerInfo) [/Users/harshit/.nvm/versions/node/v12.19.0/bin/node]
 6: 0x100258df9 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/harshit/.nvm/versions/node/v12.19.0/bin/node]
 7: 0x100258562 v8::internal::Builtin_Impl_HandleApiCall(v8::internal::BuiltinArguments, v8::internal::Isolate*) [/Users/harshit/.nvm/versions/node/v12.19.0/bin/node]
 8: 0x100a02b19 Builtins_CEntry_Return1_DontSaveFPRegs_ArgvOnStack_BuiltinExit [/Users/harshit/.nvm/versions/node/v12.19.0/bin/node]
 9: 0x1009882a4 Builtins_InterpreterEntryTrampoline [/Users/harshit/.nvm/versions/node/v12.19.0/bin/node]
[1]    3226 abort      node index.js

ronag added a commit that referenced this issue Oct 9, 2020
@ronag
Copy link
Member

ronag commented Oct 9, 2020

2.0.7 published, sorry I didn't inlcude the fix in 2.0.6 by mistake

@Jolg42
Copy link

Jolg42 commented Oct 9, 2020

Thanks! 🙇‍♂️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants