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

Core dumped when reading socket buffer #20813

Closed
koxu1996 opened this issue May 18, 2018 · 1 comment
Closed

Core dumped when reading socket buffer #20813

koxu1996 opened this issue May 18, 2018 · 1 comment
Labels
duplicate Issues and PRs that are duplicates of other issues or PRs. http Issues or PRs related to the http subsystem.

Comments

@koxu1996
Copy link

  • Version: v10.1.0
  • Platform: Linux archPC 4.16.8-1-ARCH #1 SMP PREEMPT Wed May 9 11:25:02 UTC 2018 x86_64 GNU/Linux
  • Subsystem: http-parser

I want to read request data, so I created following code:

var http = require('http')

var server = http.createServer(function(req, res) {
    res.end('Hello Node.js Server!');
})

server.on('connection', function(socket) {
    socket.setEncoding('utf8')
    socket.on('data', function(buffer) {
        console.log(buffer)
    })
})

server.listen(8080)

After opening http://127.0.0.1:8080 node is crashing:

node[7629]: ../src/node_http_parser.cc:410:static void node::{anonymous}::Parser::Execute(const v8::FunctionCallbackInfo<v8::Value>&): Assertion `(Buffer::HasInstance(args[0])) == (true)' failed.
 1: node::Abort() [node]
 2: 0x55b32d2f229b [node]
 3: 0x55b32d34bd35 [node]
 4: v8::internal::FunctionCallbackArguments::Call(v8::internal::CallHandlerInfo*) [node]
 5: 0x55b32d4fd238 [node]
 6: 0x55b32d4fd637 [node]
 7: 0x30b47ad8427d
Aborted (core dumped)

If I comment line with setEncoding then it works fine.

@richardlau
Copy link
Member

I believe this is a duplicate of #18118.

@addaleax addaleax added duplicate Issues and PRs that are duplicates of other issues or PRs. http Issues or PRs related to the http subsystem. labels May 18, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate Issues and PRs that are duplicates of other issues or PRs. http Issues or PRs related to the http subsystem.
Projects
None yet
Development

No branches or pull requests

3 participants