Commit Graph

8541 Commits (23509eb9e8de89aafebca68dde491e82a06b3cc8)

Author SHA1 Message Date
isaacs 4e8cddddcb src: use StringBytes for DecodeWrite/DecodeBytes/Encode
Bonus: this makes node::Encode actually work properly with base64,
ucs2, hex, etc.
2013-05-14 13:51:42 -07:00
isaacs 69dac92c36 src: Use StringBytes in StreamWrap 2013-05-14 13:51:42 -07:00
isaacs 64fc34b270 src: Add StringBytes static util class
Four functions:

- StringBytes::StorageSize()
- StringBytes::Size()
- StringBytes::Write()
- StringBytes::Encode()
2013-05-14 13:51:24 -07:00
isaacs 3058f08e64 tools: remove unnecessary cpplint rules
We don't actually care about header order much, and since we never use
stl classes, 'string' isn't an issue for node ever.
2013-05-14 11:36:05 -07:00
isaacs d5158574c6 stream: Make default encoding configurable
Pretty much everything assumes strings to be utf-8, but crypto
traditionally used binary strings, so we need to keep the default
that way until most users get off of that pattern.
2013-05-14 11:36:05 -07:00
isaacs bdb78b9945 stream: don't create unnecessary buffers in Readable
If there is an encoding, and we do 'stream.push(chunk, enc)', and the
encoding argument matches the stated encoding, then we're converting from
a string, to a buffer, and then back to a string.  Of course, this is a
completely pointless bit of work, so it's best to avoid it when we know
that we can do so safely.
2013-05-14 11:36:04 -07:00
isaacs 0b8af89363 lint 2013-05-14 11:36:04 -07:00
isaacs 201baa273b benchmark: hash stream 2013-05-14 11:36:04 -07:00
isaacs 6a833a38f6 blog: Release v0.11.2 2013-05-14 11:35:43 -07:00
Benoit Vallée dbe9f8da6b test: increase workers to 8 in cluster-disconnect
Increasing the number of workers from 2 to 8 makes this test
more likely to trigger race conditions. See #5330 for background.
2013-05-14 12:37:39 +02:00
Ben Noordhuis f13a3fd2af doc: clarify subsystems in CONTRIBUTING.md 2013-05-14 12:31:38 +02:00
Ben Noordhuis 9498fd15c7 deps: upgrade c-ares to 1.10.0 2013-05-14 02:07:35 +02:00
isaacs 458c8bb9f8 Now working on 0.11.3 2013-05-13 15:54:19 -07:00
isaacs dff93008a6 Merge branch 'v0.11.2-release' 2013-05-13 15:54:05 -07:00
isaacs 5d3dc0e4c3 2013.05.13, Version 0.11.2 (Unstable)
* uv: Upgrade to 0.11.2

* V8: Upgrade to 3.19.0

* npm: Upgrade to 1.2.21

* build: Makefile should respect configure --prefix (Timothy J Fontaine)

* cluster: use round-robin load balancing (Ben Noordhuis)

* debugger, cluster: each worker has new debug port (Miroslav Bajtoš)

* debugger: `restart` with custom debug port (Miroslav Bajtoš)

* debugger: breakpoints in scripts not loaded yet (Miroslav Bajtoš)

* event: EventEmitter#setMaxListeners() returns this (Sam Roberts)

* events: add EventEmitter.defaultMaxListeners (Ben Noordhuis)

* install: Support $(PREFIX) install target directory prefix (Olof Johansson)

* os: Include netmask in os.networkInterfaces() (Ben Kelly)

* path: add path.isAbsolute(path) (Ryan Doenges)

* stream: Guarantee ordering of 'finish' event (isaacs)

* streams: introduce .cork/.uncork/._writev (Fedor Indutny)

* vm: add support for timeout argument (Andrew Paprocki)
2013-05-13 14:54:38 -07:00
isaacs 31e73a5cec npm: Upgrade to 1.2.21 2013-05-13 14:24:36 -07:00
Ben Noordhuis e72cd415ad cluster: use round-robin load balancing
Empirical evidence suggests that OS-level load balancing (that is,
having multiple processes listen on a socket and have the operating
system wake up one when a connection comes in) produces skewed load
distributions on Linux, Solaris and possibly other operating systems.

The observed behavior is that a fraction of the listening processes
receive the majority of the connections. From the perspective of the
operating system, that somewhat makes sense: a task switch is expensive,
to be avoided whenever possible. That's why the operating system likes
to give preferential treatment to a few processes, because it reduces
the number of switches.

However, that rather subverts the purpose of the cluster module, which
is to distribute the load as evenly as possible. That's why this commit
adds (and defaults to) round-robin support, meaning that the master
process accepts connections and distributes them to the workers in a
round-robin fashion, effectively bypassing the operating system.

Round-robin is currently disabled on Windows due to how IOCP is wired
up. It works and you can select it manually but it probably results in
a heavy performance hit.

Fixes #4435.
2013-05-13 21:31:18 +02:00
Bert Belder bdc5881169 Merge branch 'v0.10'
Conflicts:
	tools/test.py
2013-05-13 11:13:39 -07:00
Ben Noordhuis 21bd456763 child_process: fix handle delivery
Commit 9352c19 ("child_process: don't emit same handle twice") trades
one bug for another.

Before said commit, a handle was sometimes delivered with messages it
didn't belong to.

The bug fix introduced another bug that needs some explaining. On UNIX
systems, handles are basically file descriptors that are passed around
with the sendmsg() and recvmsg() system calls, using auxiliary data
(SCM_RIGHTS) as the transport.

node.js and libuv depend on the fact that none of the supported systems
ever emit more than one SCM_RIGHTS message from a recvmsg() syscall.
That assumption is something we should probably address someday for the
sake of portability but that's a separate discussion.

So, SCM_RIGHTS messages are never coalesced. SCM_RIGHTS and normal
messages however _are_ coalesced. That is, recvmsg() might return this:

  recvmsg();  // { "message-with-fd", "message", "message" }

The operating system implicitly breaks pending messages along
SCM_RIGHTS boundaries. Most Unices break before such messages but Linux
also breaks _after_ them.  When the sender looks like this:

  sendmsg("message");
  sendmsg("message-with-fd");
  sendmsg("message");

Then on most Unices the receiver sees messages arriving like this:

  recvmsg();  // { "message" }
  recvmsg();  // { "message-with-fd", "message" }

The bug fix in commit 9352c19 assumes this behavior. On Linux however,
those messages can also come in like this:

  recvmsg();  // { "message", "message-with-fd" }
  recvmsg();  // { "message" }

In other words, it's incorrect to assume that the file descriptor is
always attached to the first message. This commit makes node wise up.

Fixes #5330.
2013-05-13 10:49:59 -07:00
Nick Sullivan 8db693a87e util: make util.log handle non strings like console.log
util.log will fail on input that does not support .toString(). Have it
use console.log() instead. Includes tests for hairy data types.

Fixes #5349.
2013-05-13 12:35:17 +02:00
Ben Noordhuis 69572a3965 test: fix up weakref.cc deprecation warnings 2013-05-13 06:46:55 +02:00
Ben Noordhuis 7bfcaa8f91 test: fix up weakref.cc after v8 api change 2013-05-13 06:45:05 +02:00
Ben Noordhuis 7349667467 stream_wrap: MayContainNonAscii() is deprecated
V8 3.19.0 deprecates v8::String::MayContainNonAscii(). It always returns
true so there is not much point in keeping the call site around.
2013-05-13 04:40:14 +02:00
Ben Noordhuis 0c405cff68 v8: reapply floating patches 2013-05-13 03:29:52 +02:00
Ben Noordhuis 7ee538ddfe deps: upgrade v8 to 3.19.0 2013-05-13 03:28:40 +02:00
isaacs fc58a5d4bd npm: Upgrade to 1.2.20 2013-05-10 17:45:37 -07:00
isaacs 5e9c7a92f2 test: Darwin file watcher has paths now
Even when watching subdirs.
2013-05-10 16:40:03 -07:00
isaacs fede68fd68 uv: Upgrade to 0.11.2 2013-05-10 15:30:53 -07:00
isaacs 4b69bcfc66 doc: s/search.npmjs.org/npmjs.org/ 2013-05-09 15:15:39 -07:00
isaacs ec576235f1 http: Use writev instead of the hacky hot end 2013-05-09 09:35:32 -07:00
isaacs a58454226f stream: Handle multi-corking properly
This adds proper support for the following situation:

    w.cork();
    w.write(...);
    w.cork();
    w.write(...);
    w.uncork();
    w.write(...);
    w.uncork();

This is relevant when you have a function (as we do in HTTP) that wants
to use cork, but in some cases, want to have a cork/uncork *around*
that function, without losing the benefits of writev.
2013-05-09 09:35:32 -07:00
isaacs c38ce9bc0a stream: Guarantee ordering of 'finish' event
In synchronous Writable streams (where the _write cb is called on the
current tick), the 'finish' event (and thus the end() callback) can in
some cases be called before all the write() callbacks are called.

Use a counter, and have stream.Transform rely on the 'prefinish' event
instead of the 'finish' event.

This has zero effect on most streams, but it corrects an edge case and
makes it perform more deterministically, which is a Good Thing.
2013-05-09 09:35:32 -07:00
Timothy J Fontaine 72c58158f7 test: fix pummel/test-net-many-clients.js
client sockets no longer emit 'connect' event inside the
requestListener, update test-net-many-clients to reflect that
2013-05-08 19:31:45 -07:00
Robert Kowalski dc92ff8585 doc: document stream.Writable 'error' event
Fixes #5255.
2013-05-08 18:15:50 -07:00
Ben Kelly 8a407f58b9 os: Include netmask in os.networkInterfaces()
re #3765 and #5432
fixes #4743
2013-05-08 17:04:29 -07:00
Miroslav Bajtoš fbf4641462 src: initialize debug-related uv_async_t handles
uv_async_t handles for dispatching of debug messages and
emitting NODE_DEBUG_ENABLED used to be initialized every time
node::EnableDebug() was called, which happened every time
user sends a SIGUSR1.

Now they are initialized only once from node::Init() during
application start.
2013-05-08 16:53:53 -07:00
Miroslav Bajtoš 43ec1b1c2e debugger, cluster: each worker has new debug port
Implement support for debugging cluster workers. Each worker process
is assigned a new debug port in an increasing sequence.

I.e. when master process uses port 5858, then worker 1 uses port 5859,
worker 2 uses port 5860, and so on.

Introduce new command-line parameter '--debug-port=' which sets debug_port
but does not start debugger. This option works for all node processes, it
is not specific to cluster workers.

Fixes joyent/node#5318.
2013-05-08 16:53:52 -07:00
Daniel Moore 3b6fc600e2 stream: make Readable.wrap support empty streams
This makes Readable.wrap behave properly when the wrapped stream ends
before emitting any data events.
2013-05-08 11:59:40 -07:00
Daniel Moore 1ad93a6584 stream: make Readable.wrap support objectMode
Added a check to see if the stream is in objectMode before deciding
whether to include or exclude data from an old-style wrapped stream.
2013-05-08 11:59:28 -07:00
Timothy J Fontaine cf87ee67ee test: don't use total_seconds() because of py2.6 2013-05-07 15:40:04 -07:00
Timothy J Fontaine 56492de5b9 test: don't use total_seconds() because of py2.6 2013-05-07 15:33:47 -07:00
Brian White aca275f58d stream_wrap: fix memory leak on early return 2013-05-07 15:05:54 -07:00
Trevor Norris b7f6e6b42f stream_wrap: remove unused arg from WriteBuffer
WriteBuffer was changed in the cork/uncork implementation (60ed2c54).
The unused argument has been removed.
2013-05-07 14:44:40 -07:00
Timothy J Fontaine ee4f0baeac test: report test duration in TAP progress 2013-05-07 13:13:44 -07:00
Timothy J Fontaine 716176fa99 test: report test duration in TAP progress 2013-05-07 12:51:03 -07:00
Timothy J Fontaine a90dc41df2 test: reap children when cluster-bind-twice fails 2013-05-06 11:31:57 -07:00
Timothy J Fontaine 5037f9a5f4 build: only use DESTDIR instead of PREFIX for pkg
Preserve default install prefix seen in process.config, but use DESTDIR
for installing to deliniate 32/64 versions, avoid conflicts with PREFIX
settings in config.mk
2013-05-06 10:19:08 -07:00
Timothy J Fontaine 76cbd039b9 build: only use DESTDIR instead of PREFIX for pkg
Preserve default install prefix seen in process.config, but use DESTDIR
for installing to deliniate 32/64 versions, avoid conflicts with PREFIX
settings in config.mk
2013-05-06 10:10:05 -07:00
Kevin Locke 1c2b03dea5 doc: update options for exec and execFile
The stdio and customFds options are never used by exec or execFile,
remove them from the documentation for these functions.
2013-05-03 16:01:33 +02:00
Bert Belder fb9d66bceb Merge branch 'v0.10' 2013-05-03 11:33:47 +02:00