Skip to content
This repository has been archived by the owner on Sep 18, 2019. It is now read-only.

Sockets are left open on http parse error #468

Closed
chhams opened this issue Mar 31, 2017 · 2 comments
Closed

Sockets are left open on http parse error #468

chhams opened this issue Mar 31, 2017 · 2 comments

Comments

@chhams
Copy link

chhams commented Mar 31, 2017

Hi,

We discovered that when we are using nodejs >= 6.0 sockets are left open when a http parsing error occurs during a request. This issues didn't occur in nodejs 4.

To reproduce this error just set up a minimal hapi server and curl it with an invalid request:

'use strict';
const Hapi = require('hapi');
const server = new Hapi.Server();
server.connection({ port: 3000, host: 'localhost' });
server.start((err) => {
    if (err) {
        throw err;
    }
    console.log(`Server running at: ${server.info.uri}`);
});

Start the server with debug enabled:
NODE_DEBUG=http node index.js

Now query it with an request containing for example a white space:
curl -G "localhost:3000/white space"

The result is, that the socket is not closed and the request hangs until the timeout is reached:

HTTP 89708: SERVER new http connection
HTTP 89708: SERVER socketOnParserExecute NaN
HTTP 89708: parse error
...

Expected behavior would be that the socket is closed right after the request. This is the case when using only http, express or hapi with nodejs 4:

HTTP 77815: SERVER new http connection
HTTP 77815: SERVER socketOnParserExecute NaN
HTTP 77815: parse error
HTTP 77815: server socket close
@Marsup
Copy link

Marsup commented Mar 31, 2017

@nlf is hapijs/hapi#3461 fixing that ?

@nlf
Copy link

nlf commented Mar 31, 2017

Yes

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

No branches or pull requests

4 participants