Skip to content

Instantly share code, notes, and snippets.

@OrangeDog
Last active December 21, 2015 12:29
Show Gist options
  • Save OrangeDog/6305863 to your computer and use it in GitHub Desktop.
Save OrangeDog/6305863 to your computer and use it in GitHub Desktop.
Node.JS - Connection:close behaviour changed between 0.8.x and 0.10.x
require('http').createServer(function(req, resp) {
console.log('start', req.connection.remoteAddress, req.connection.remotePort);
resp.end();
console.log('end', req.connection.remoteAddress, req.connection.remotePort);
}).listen(5000);
node8 --version
# v0.8.22
node8 test.js &
curl http://localhost:5000
# start 127.0.0.1 60959
# end 127.0.0.1 60959
curl http://localhost:5000 -H Connection:close
# start 127.0.0.1 60960
# end 127.0.0.1 60960
pkill node8
node10 --version
# v0.10.17
node10 test.js &
curl http://localhost:5000
# start 127.0.0.1 60961
# end 127.0.0.1 60961
curl http://localhost:5000 -H Connection:close
# start 127.0.0.1 60962
# end undefined undefined
/usr/bin/python tools/test.py --mode=release simple message
=== release test-debugger-client ===
Path: simple/test-debugger-client
ready!
>>> new node process: 27974
>>> starting debugger session
version: 3.14.5.9
ready!
>>> new node process: 27978
>>> starting debugger session
got stderr data "debugger listening on port 13683\n"
>>> connecting...
requesting version
>>> killing node process 27974
got stderr data "debugger listening on port 13683\n"
>>> connecting...
requesting scripts
got 2 scripts
>>> killing node process 27978
got stderr data "debugger listening on port 13683\n"
>>> connecting...
events.js:72
throw er; // Unhandled 'error' event
^
Error: connect ECONNREFUSED
at errnoException (net.js:901:11)
at Object.afterConnect [as oncomplete] (net.js:892:19)
Command: out/Release/node /home/jhowe/build/node/test/simple/test-debugger-client.js
=== release test-debugger-repl ===
Path: simple/test-debugger-repl
< debugger listening on port 13683
connecting... ok
./node debug --port=13683 /home/jhowe/build/node/test/fixtures/breakpoints.js
dying badly buffer="debug> "
child is closed
UncaughtException [Error: Timeout. Expected: /break in .*:1/] Error: Timeout. Expected: /break in .*:1/
at ChildProcess.<anonymous> (/home/jhowe/build/node/test/simple/helper-debugger-repl.js:89:13)
at ChildProcess.EventEmitter.emit (events.js:117:20)
at maybeClose (child_process.js:735:16)
at Process.ChildProcess._handle.onexit (child_process.js:802:5)
Error: Timeout. Expected: /break in .*:1/
process exit 1
Command: out/Release/node /home/jhowe/build/node/test/simple/test-debugger-repl.js
=== release test-http-curl-chunk-problem ===
Path: simple/test-http-curl-chunk-problem
dd command: dd if=/dev/zero of="/home/jhowe/build/node/test/tmp/big" bs=1024 count=10240
Server running at http://localhost:8080
making curl request
assert.js:92
throw new assert.AssertionError({
^
AssertionError: "8c206a1a87599f532ce68675536f0b1546900d7a" == "2f63dc5f0238c054241f0f61aecd2f8fc39c84ff"
at /home/jhowe/build/node/test/simple/test-http-curl-chunk-problem.js:44:12
at ChildProcess.exithandler (child_process.js:635:7)
at ChildProcess.EventEmitter.emit (events.js:98:17)
at maybeClose (child_process.js:735:16)
at Process.ChildProcess._handle.onexit (child_process.js:802:5)
Command: out/Release/node /home/jhowe/build/node/test/simple/test-http-curl-chunk-problem.js
=== release test-http-dns-error ===
Path: simple/test-http-dns-error
assert.js:92
throw new assert.AssertionError({
^
AssertionError: "EADDRINFO" == "ENOTFOUND"
at ClientRequest.<anonymous> (/home/jhowe/build/node/test/simple/test-http-dns-error.js:49:12)
at ClientRequest.EventEmitter.emit (events.js:95:17)
at CleartextStream.socketErrorListener (http.js:1548:9)
at CleartextStream.EventEmitter.emit (events.js:95:17)
at Socket.onerror (tls.js:1432:17)
at Socket.EventEmitter.emit (events.js:117:20)
at net.js:830:16
at process._tickCallback (node.js:415:13)
Command: out/Release/node /home/jhowe/build/node/test/simple/test-http-dns-error.js
=== release test-net-dns-error ===
Path: simple/test-net-dns-error
assert.js:92
throw new assert.AssertionError({
^
AssertionError: "EADDRINFO" == "ENOTFOUND"
at Socket.<anonymous> (/home/jhowe/build/node/test/simple/test-net-dns-error.js:43:10)
at Socket.EventEmitter.emit (events.js:95:17)
at net.js:830:16
at process._tickCallback (node.js:415:13)
Command: out/Release/node /home/jhowe/build/node/test/simple/test-net-dns-error.js
[01:57|% 100|+ 592|- 5]: Done
make: *** [test] Error 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment