Commit Graph

7136 Commits (4d809e297f905daf198b252a5870e8732d4201e6)

Author SHA1 Message Date
Nathan Rajlich 4d809e297f process: invoke EventEmitter on `process`
This properly sets the `_maxListeners` property, which
fixes the max listener warning. Closes #4924.
2013-03-05 21:15:45 -08:00
Ben Noordhuis 532d9929c7 cluster: propagate bind errors
This commit fixes a bug where the cluster module fails to propagate
EADDRINUSE errors.

When a worker starts a (net, http) server, it requests the listen socket
from its master who then creates and binds the socket.

Now, OS X and Windows don't always signal EADDRINUSE from bind() but
instead defer the error until a later syscall. libuv mimics this
behaviour to provide consistent behaviour across platforms but that
means the worker could end up with a socket that is not actually bound
to the requested addresss.

That's why the worker now checks if the socket is bound, raising
EADDRINUSE if that's not the case.

Fixes #2721.
2013-03-05 15:23:55 +01:00
Ben Noordhuis ecf9f606c9 doc: add url.resolve() usage examples
Fixes #4913.
2013-03-04 20:54:36 +01:00
Rod Vagg a6a1659d85 link to LevelUP modules wiki page, not level-hooks 2013-03-03 22:12:53 -08:00
Ben Noordhuis 426cbedb44 test: make simple/test-dgram-pingpong respect PORT
Don't use hard-coded port numbers, use common.PORT instead.

Should fix the occasional Jenkins failure; the builds run in parallel.
2013-03-02 23:04:06 +01:00
Timothy J Fontaine 0b70a14abf test: optionally set common.PORT via env variable
This is a back-port of commit 17a8126 from the master branch.
2013-03-02 19:09:39 +01:00
Ben Noordhuis 7189b3ed33 crypto: don't assert when calling Cipher#final() twice
Remove the assert() that triggered when Cipher#final() or
Decipher#final() was called twice.

Fixes #4886.
2013-03-02 02:13:18 +01:00
isaacs be770a3839 blog: Post about v0.9.11 2013-03-01 11:24:46 -08:00
Ben Noordhuis f26362e938 http: use socket.once, not socket.on
Register the 'close' event listener with .once(), not .on().

It doesn't matter in the grand scheme of things because the listener
doesn't keep references to any heavy-weight objects but using .once()
for a oneshot listener is something of a best practice.
2013-03-01 13:11:40 +01:00
Eugene Girshov 50ba0f27d9 doc: remove note about close event 2013-03-01 00:01:06 +01:00
Timothy J Fontaine d032ff4954 test: fix tap output on windows
Test output is always \n and not platform dependent
2013-02-28 23:13:05 +01:00
Ben Noordhuis d879042860 build, windows: disable SEH
Turn off safe exception handlers, they're incompatible with how
openssl is compiled / linked under MSVS 2012.

Addresses the following build error:

  openssl.lib(x86cpuid.obj) : error LNK2026: module unsafe for SAFESEH
  image. [g:\jenkins\workspace\nodejs-oneoff\node.vcxproj]
  openssl.lib(x86.obj) : error LNK2026: module unsafe for SAFESEH
  image. [g:\jenkins\workspace\nodejs-oneoff\node.vcxproj]
  # etc. etc.
  g:\jenkins\workspace\nodejs-oneoff\Release\node.exe : fatal error
  LNK1281: Unable to generate SAFESEH image.
  [g:\jenkins\workspace\nodejs-oneoff\node.vcxproj]

Fixes #4242.
2013-02-28 16:40:13 +01:00
Ben Noordhuis 522668b5d9 doc: update instructions on home page
Document how to run the example on the home page in more detail.

Apparently our Windows brethren are prone to double-clicking on the
binary instead of running it from the command line.

Fixes #4854.
2013-02-28 16:30:46 +01:00
isaacs 82357b87eb blog: Update with EINPROGRESS changelog item 2013-02-25 14:17:11 -08:00
isaacs fafb67c65b ChangeLog: Missed item about EINPROGRESS 2013-02-25 13:57:02 -08:00
isaacs f8ae4446ee blog: Post for v0.8.21 2013-02-25 13:56:46 -08:00
isaacs 33e8e694e8 Now working on 0.8.22 2013-02-25 13:52:13 -08:00
isaacs 7b92b301fa Merge branch 'v0.8.21-release' into v0.8 2013-02-25 13:51:15 -08:00
isaacs 530d8c05d4 2013.02.25, Version 0.8.21 (Stable)
* http: Do not free the wrong parser on socket close (isaacs)

* http: Handle hangup writes more gently (isaacs)

* zlib: fix assert on bad input (Ben Noordhuis)

* test: add TAP output to the test runner (Timothy J Fontaine)

* unix: Handle EINPROGRESS from domain sockets (Ben Noordhuis)
2013-02-25 13:07:25 -08:00
isaacs ff540e19a4 uv: Upgrade to 86ae8b3c 2013-02-25 13:07:25 -08:00
isaacs b0e7dbf2c0 http: Do not free the wrong parser on socket close
This appears to fix #4673.  That bug is very hard to reproduce, so it's
hard to tell for certain, but this approach is more correct anyway.

Hat-tip: @dougwilson
2013-02-25 09:06:46 -08:00
isaacs f9a0140ef1 http: Handle hangup writes more gently 2013-02-22 10:35:07 -08:00
Ben Noordhuis 22d3eff8f4 doc: add note about child process line buffering
Fixes #4808.
2013-02-22 01:19:40 +01:00
Ben Noordhuis ef94521909 zlib: fix assert on bad input
The following test case occasionally triggered an assert because
write_in_progress_ didn't get cleared on error:

  $ cat test.js
  require('zlib').gunzip('BAM', console.log);
  setTimeout(gc, 10);

  $ while true; do node --expose-gc test.js || break; done
  { [Error: incorrect header check] errno: -3, code: 'Z_DATA_ERROR' }
  Assertion failed: (!write_in_progress_ && "write in progress"),
  function Clear, file ../src/node_zlib.cc, line 71.
  Abort trap: 6

Steps to avoid that:

* Initialize all primitive member fields in the constructor.
* Clear the write_in_progress_ member field in ZCtx::Error().
* Ref the ZCtx object as soon as write_in_progress_ is set to true.
  Before this commit, it could get GC'ed in the time between setting
  the field and the call to ctx->Ref().

Fixes #4783.
2013-02-22 00:08:26 +01:00
Timothy J Fontaine 9d45b945f7 test: add TAP output to the test runner
This is a back-port of commit 14ed173 from the master branch.
2013-02-20 18:50:55 +01:00
isaacs 3267464586 blog: v0.9.10 2013-02-19 14:01:23 -08:00
isaacs 3f38069acf blog: Release v0.8.20 2013-02-15 11:24:20 -08:00
isaacs 01bff7e7a7 Now working on v0.8.21 2013-02-15 11:24:08 -08:00
isaacs 48521f1220 Merge branch 'v0.8.20-release' into v0.8 2013-02-15 11:23:55 -08:00
isaacs e10c75579b 2013.02.15, Version 0.8.20 (Stable)
* npm: Upgrade to v1.2.11

* http: Do not let Agent hand out destroyed sockets (isaacs)

* http: Raise hangup error on destroyed socket write (isaacs)

* http: protect against response splitting attacks (Bert Belder)
2013-02-15 10:50:11 -08:00
isaacs 73be4608d9 npm: Upgrade to v1.2.11 2013-02-15 10:49:30 -08:00
isaacs 987338fe31 http: Do not let Agent hand out destroyed sockets
Fix #4373
2013-02-14 16:03:40 -08:00
isaacs c9dcf5718c http: Raise hangup error on destroyed socket write
Prior to v0.10, Node ignored ECONNRESET errors in many situations.
There *are* valid cases in which ECONNRESET should be ignored as a
normal part of the TCP dance, but in many others, it's a very relevant
signal that must be heeded with care.

Exacerbating this problem, if the OutgoingMessage does not have a
req.connection._handle, it assumes that it is in the process of
connecting, and thus buffers writes up in an array.

The problem happens when you reuse a socket between two requests, and it
is destroyed abruptly in between them.  The writes will be buffered,
because the socket has no handle, but it's not ever going to GET a
handle, because it's not connecting, it's destroyed.

The proper fix is to treat ECONNRESET correctly.  However, this is a
behavior/semantics change, and cannot land in a stable branch.

Fix #4775
2013-02-14 16:03:40 -08:00
Ben Noordhuis 3e2be6f39f doc: clarify child_process.exec() stdio option
It only works for stdin, not stdout/stderr, for obvious reasons.
2013-02-14 19:42:14 +01:00
Ben Noordhuis aec6e93931 doc: add tools/ dir to CONTRIBUTING.md verboten list 2013-02-14 12:42:57 +01:00
Dan Kohn 2e1ebbf2c5 doc: add prompt to fix repl_test.js example
Running repl.start without the prompt set produces this error:

repl.js:95
    throw new Error('An options Object, or a prompt String are required');
          ^
Error: An options Object, or a prompt String are required
    at new REPLServer (repl.js:95:11)
    at Object.exports.start (repl.js:321:14)
    at Object.<anonymous> (/Users/dan/Dropbox/Documents/dev/nextgen/repl_test.js:5:6)
    at Module._compile (module.js:449:26)
    at Object.Module._extensions..js (module.js:467:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.runMain (module.js:492:10)
    at process.startup.processNextTick.process._tickCallback (node.js:244:9)
2013-02-13 16:40:27 +01:00
isaacs 82ad5fbe9a blog: Forgot slug on peer-dependencies article 2013-02-12 16:30:25 -08:00
isaacs 6dcadb9fc8 blog: Peer Dependencies article
Thanks, @domenic
2013-02-12 12:03:52 -08:00
Ben Noordhuis c4f418d035 test: disable simple/test-dgram-send-error
It's not a good citizen, it spams random IP addresses with UDP packets.

Fixes #4730.
2013-02-08 01:33:33 +01:00
isaacs 2810b1ab00 blog: v0.9.9 is unstable, not stable 2013-02-07 10:35:35 -08:00
isaacs e4d97b1dca blog: v0.9.9 2013-02-07 10:34:45 -08:00
Bert Belder 255bc945c2 http: protect against response splitting attacks
This patch is a back-port of 3c293ba.
Closes #4696
2013-02-07 14:39:47 +01:00
isaacs 13897279ae blog: v0.8.19 release 2013-02-06 09:48:20 -08:00
isaacs ccf2712ee5 Now working on 0.8.20 2013-02-06 09:46:47 -08:00
isaacs 8caf6572b6 Merge branch 'v0.8.19-release' into v0.8 2013-02-06 09:44:38 -08:00
isaacs 53978bdf42 2013.02.06, Version 0.8.19 (Stable)
* npm: Upgrade to v1.2.10

* zlib: pass object size hint to V8 (Ben Noordhuis)

* zlib: reduce memory consumption, release early (Ben Noordhuis)

* buffer: slow buffer copy compatibility fix (Trevor Norris)

* zlib: don't assert on malformed dictionary (Ben Noordhuis)

* zlib: don't assert on missing dictionary (Ben Noordhuis)

* windows: better ipv6 support (Bert Belder)

* windows: add error mappings related to unsupported protocols (Bert Belder)

* windows: map ERROR_DIRECTORY to UV_ENOENT (Bert Belder)
2013-02-06 08:46:14 -08:00
isaacs 5aef65a98a npm: Upgrade to v1.2.10 2013-02-06 08:39:31 -08:00
Ben Noordhuis a86ebbe288 blog: remove dangling symlink
Fixes #4716.
2013-02-05 22:34:51 +01:00
Ben Noordhuis 6b99fd2323 zlib: pass object size hint to V8
Inform V8 that the zlib context object is tied to a large off-heap buffer.

This makes the GC run more often (in theory) and improves the accuracy of
--trace_external_memory.
2013-02-05 22:26:03 +01:00
Ben Noordhuis 8d14668992 zlib: reduce memory consumption, release early
In zlibBuffer(), don't wait for the garbage collector to reclaim the zlib memory
but release it manually. Reduces memory consumption by a factor of 10 or more
with some workloads.

Test case:

  function f() {
    require('zlib').deflate('xxx', g);
  }
  function g() {
    setTimeout(f, 5);
  }
  f();

Observe RSS memory usage with and without this commit. After 10,000 iterations,
RSS stabilizes at ~35 MB with this commit. Without, RSS is over 300 MB and keeps
growing.

Cause: whenever the JS object heap hits the high-water mark, the V8 GC sweeps
it clean, then tries to grow it in order to avoid more sweeps in the near
future. Rule of thumb: the bigger the JS heap, the lazier the GC can be.

A side effect of a bigger heap is that objects now live longer. This is harmless
in general but it affects zlib context objects because those are tied to large
buffers that live outside the JS heap, on the order of 16K per context object.

Ergo, don't wait for the GC to reclaim the memory - it may take a long time.

Fixes #4172.
2013-02-05 22:25:54 +01:00