Skip to content

Assertion `(parser->current_buffer_len_) == (0)' failed #15102

Description

@nitroxis

Hi,

I get the following crash from time to time (randomly, it seems):

/usr/local/bin/node[26969]: ../src/node_http_parser.cc:420:static void node::{anonymous}::Parser::Execute(const v8::FunctionCallbackInfo<v8::Value>&): Assertion `(parser->current_buffer_len_) == (0)' failed.
Main process exited, code=killed, status=6/ABRT
 1: node::Abort() [/usr/local/bin/node]
 2: node::Assert(char const* const (*) [4]) [/usr/local/bin/node]
 3: 0x14135d1 [/usr/local/bin/node]
 4: 0xcc6de636c65

I'm not entirely sure where this comes from as there is no JS stack trace, but I believe it happens when processing the response of a HTTP request. This bug has been around for a long time, but it's very inconsistent. It might have already been reported here, at least it seems to be related.

Activity

  1. BridgeAR commented on Aug 30, 2017

    @BridgeAR
    Member

    Does the same error occur with 8.4?

  2. nitroxis commented on Aug 30, 2017

    @nitroxis
    Author

    I will try to update node, but it might take weeks until it happens again, unless I find a way to reproduce it.

  3. added
    c++Issues and PRs that require attention from people who are familiar with C++.
    httpIssues and PRs related to the http subsystem.
    on Aug 30, 2017
  4. bnoordhuis commented on Sep 11, 2017

    @bnoordhuis
    Member

    I'll close this out for now, let us know if you can reproduce with the latest v8.x.

  5. nitroxis commented on Sep 11, 2017

    @nitroxis
    Author

    Coincidentally, it just happened again. Same stack trace, different line:

    /usr/local/bin/node[23084]: ../src/node_http_parser.cc:423:static void node::{anonymous}::Parser::Execute(const v8::FunctionCallbackInfo<v8::Value>&): Assertion `(parser->current_buffer_len_) == (0)' failed.
     1: node::Abort() [/usr/local/bin/node]
     2: node::Assert(char const* const (*) [4]) [/usr/local/bin/node]
     3: 0x142b461 [/usr/local/bin/node]
     4: 0x11eabb74aac7
    Main process exited, code=killed, status=6/ABRT
    

    I still don't know where exactly in the JS code this happened.

  6. psamim commented on Sep 17, 2017

    @psamim

    It also happened to me, node version 8.4.0 on Archlinux. The 8:54:18 AM api.1 part in the log is from node-foreman.

    8:54:18 AM api.1       |  /usr/bin/node[5205]: ../src/node_http_parser.cc:423:static void node::{anonymous}::Parser::Execute(const v8::FunctionCallbackInfo<v8::Value>&): Assertion `(parser->current_buffer_len_) == (0)' failed.
    8:54:18 AM api.1       |   1:
    8:54:18 AM api.1       |  node::Abort() [/usr/bin/node]
    8:54:18 AM api.1       |   2:
    8:54:18 AM api.1       |  node::Assert(char const* const (*) [4]) [/usr/bin/node]
    8:54:18 AM api.1       |   3: 0x5616b4c073dd [/usr/bin/node]
    8:54:18 AM api.1       |   4: v8::internal::FunctionCallbackArguments::Call(void (*)(v8::FunctionCallbackInfo<v8::Value> const&)) [/usr/bin/node]
    8:54:18 AM api.1       |   5: 0x5616b442414c [/usr/bin/node]
    8:54:18 AM api.1       |   6: 0x5616b4424754 [/usr/bin/node]
    8:54:18 AM api.1       |   7: 0x5350f1840dd
    
  7. addaleax commented on Sep 17, 2017

    @addaleax
    Member

    @psamim Any chance you could get us a core dump of that crash?

  8. psamim commented on Sep 17, 2017

    @psamim
  9. SINHASantos commented on Sep 18, 2017

    @SINHASantos

    linux node v8.4.0

    /usr/local/bin/node[30809]: ../src/node_http_parser.cc:423:static void node::{a nonymous}::Parser::Execute(const v8::FunctionCallbackInfov8::Value&): Asserti on `(parser->current_buffer_len_) == (0)' failed.
    1: node::Abort() [node]
    2: node::Assert(char const* const () [4]) [node]
    3: 0x13c5bcd [node]
    4: v8::internal::FunctionCallbackArguments::Call(void (
    )(v8::FunctionCallback Infov8::Value const&)) [node]
    5: 0xc3ac4a [node]
    6: v8::internal::Builtin_HandleApiCall(int, v8::internal::Object**, v8::intern al::Isolate*) [node]
    7: 0x39c5acd040dd
    Aborted

    solution:

    1. install following module

    npm install http-parser-js

    1. and add the line below in your code

    process.binding('http_parser').HTTPParser = require('http-parser-js').HTTPParser;

    and it solves the problem

  10. cjihrig commented on Sep 18, 2017

    @cjihrig
    Contributor

    I do not know how.

    @psamim start Node with the --abort-on-uncaught-exception flag. Before starting node, also run ulimit -c unlimited.

  11. psamim commented on Sep 19, 2017

    @psamim

    @cjihrig I did and the same thing happened:

    3:56:58 PM api.1       |  /usr/bin/node[22446]: ../src/node_http_parser.cc:423:static void node::{anonymous}::Parser::Execute(const v8::FunctionCallbackInfo<v8::Value>&): Assertion `(parser->current_buffer_len_) == (0)' failed.
    3:56:58 PM api.1       |   1:
    3:56:58 PM api.1       |  node::Abort()
    3:56:58 PM api.1       |   [/usr/bin/node]
    3:56:58 PM api.1       |   2:
    3:56:58 PM api.1       |  node::Assert(char const* const (*) [4])
    3:56:58 PM api.1       |   [/usr/bin/node]
    3:56:58 PM api.1       |   3:
    3:56:58 PM api.1       |  0x5616f1cbd3dd [/usr/bin/node]
    3:56:58 PM api.1       |   4: v8::internal::FunctionCallbackArguments::Call(void (*)(v8::FunctionCallbackInfo<v8::Value> const&)) [/usr/bin/node]
    3:56:58 PM api.1       |   5: 0x5616f14da14c [/usr/bin/node]
    3:56:58 PM api.1       |   6:
    3:56:58 PM api.1       |  0x5616f14da754 [/usr/bin/node]
    3:56:58 PM api.1       |   7: 0x3f5c6b9840dd
    
  12. addaleax commented on Sep 19, 2017

    @addaleax
    Member

    @psamim Do you find a file name core or similar where you were running your node program?

  13. 18 remaining items

  14. addaleax commented on Jul 7, 2020

    @addaleax
    Member

    For a workaround, you might be able to wrap the self.writeBody(stream, httpRequest); line in aws-sdk/lib/http/node.js:102 as setImmediate(() => self.writeBody(stream, httpRequest));, I think that would fix this for you. (Unfortunately, there probably isn’t any way to fix this in your code without monkey-patching either the AWS library or Node’s HTTP internals…)

  15. addaleax commented on Jul 7, 2020

    @addaleax
    Member

    Looks like the fix was f663b31, which was semver-major, so I’ll open a separate fix instead of backporting that

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    c++Issues and PRs that require attention from people who are familiar with C++.httpIssues and PRs related to the http subsystem.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions