This is a squashed commit of the main work done on the domains-wip branch.
The original commit messages are preserved for posterity:
* Implicitly add EventEmitters to active domain
* Implicitly add timers to active domain
* domain: add members, remove ctor cb
* Don't hijack bound callbacks for Domain error events
* Add dispose method
* Add domain.remove(ee) method
* A test of multiple domains in process at once
* Put the active domain on the process object
* Only intercept error arg if explicitly requested
* Typo
* Don't auto-add new domains to the current domain
While an automatic parent/child relationship is sort of neat,
and leads to some nice error-bubbling characteristics, it also
results in keeping a reference to every EE and timer created,
unless domains are explicitly disposed of.
* Explicitly adding one domain to another is still fine, of course.
* Don't allow circular domain->domain memberships
* Disposing of a domain removes it from its parent
* Domain disposal turns functions into no-ops
* More documentation of domains
* More thorough dispose() semantics
* An example using domains in an HTTP server
* Don't handle errors on a disposed domain
* Need to push, even if the same domain is entered multiple times
* Array.push is too slow for the EE Ctor
* lint domain
* domain: docs
* Also call abort and destroySoon to clean up event emitters
* domain: Wrap destroy methods in a try/catch
* Attach tick callbacks to active domain
* domain: Only implicitly bind timers, not explicitly
* domain: Don't fire timers when disposed.
* domain: Simplify naming so that MakeCallback works on Timers
* Add setInterval and nextTick to domain test
* domain: Make stack private
The idea here is to reduce the number of times that `setRawMode()` is called
on the `input` stream, since it is expensive, and simply pause()/resume()
should not call it.
So now `setRawMode()` only gets called at the beginning of the Interface
instance, and then when `Interface#close()` is called.
Test case included.
Don't assume that the libcrypto and libssl that we're linked against is the same
version as the openssl command line tool. This is important because the tool has
a bug in all pre-1.0.0 versions that makes it unusable for these tests.
If the fs.open method is modified via AOP-style extension, in between
the creation of an fs.WriteStream and the processing of its action
queue, then the test of whether or not the method === fs.open will fail,
because fs.open has been replaced.
The solution is to save a reference to fs.open on the stream itself when
the action is placed in the queue.
This fixesisaacs/node-graceful-fs#6.
If the fs.open method is modified via AOP-style extension, in between
the creation of an fs.WriteStream and the processing of its action
queue, then the test of whether or not the method === fs.open will fail,
because fs.open has been replaced.
The solution is to save a reference to fs.open on the stream itself when
the action is placed in the queue.
This fixesisaacs/node-graceful-fs#6.
Travis-CI is failing on this test repeatedly, but other Linux systems
seem to be fine with it. Alter the logging so it's more clear which
part is timing out.
Said test adds little value and only serves to annoy me when moving around
modules. It was broken anyway: it passed inside the test runner and failed
when run from the command line thanks to the environment sniffing it did.
This should only be minimally used, since the `terminal` value will usually be
what you are expecting. This option is specifically for the case where `terminal`
is false, but you still want colors to be output (or vice-versa).
The 'Can't backtrace now' message takes over 10 seconds to return.
That's too much time to have to wait for a test, and when it times
out, it was causing an orphaned node process.
This cleans up the node process, and also removes the test that's
timing out, so that the case is hit less often.
Todo: Make the backtrace message come back faster.
* It incorrectly uses assert(a, b) instead of assert.equal(a, b), meaning all
relevant assertions will pass regardless of whether they're supposed to when
a == true.
* It makes the assumption that elements in typed arrays for numerical types
spanning more than one byte, like Uint32Array, are stored little-endian first
on all machines.
* It contains assorted mistakes like assert(Int32Array, typeof v4) (that one
only passes thanks to point 1).
This patch will kill the worker once it has lost its connection with the parent.
However if the worker are doing a suicide, other measures will be used.
This patch add a worker.disconnect() method there will stop the worker from accepting
new connections and then stop the IPC. This allow the worker to die graceful.
When the IPC has been disconnected a 'disconnect' event will emit.
The patch also add a cluster.disconnect() method, this will call worker.disconnect() on
all connected workers. When the workers are disconneted it will then close all server
handlers. This allow the cluster itself to self terminate in a graceful way.
Said test checks that the workers shut down when the master errors but it failed
intermittently. Insert a small delay before doing the 'is dead?' check to give
the workers a chance to shut down.