Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
99 commits
Select commit Hold shift + click to select a range
699bf2c
doc: fix link in addons.markdown
secretfader Dec 17, 2015
5ce6e99
doc: Typo in buffer.markdown referencing buf.write()
chrisJohn404 Dec 17, 2015
04dd861
doc: fix, modernize examples in docs
jasnell Dec 14, 2015
b841967
http: Remove an unnecessary assignment
gigabo Dec 17, 2015
a5094a3
debugger: guard against call from non-node context
bnoordhuis Dec 17, 2015
96501e5
test: try other ipv6 localhost alternatives
mscdex Dec 17, 2015
8464667
node: fix erroneously named function call
trevnorris Nov 10, 2015
b8366e7
http_parser: use pushValueToArray for headers
trevnorris Nov 10, 2015
e742422
fs: use pushValueToArray for readdir(Sync)
trevnorris Nov 10, 2015
c8fc217
node: improve GetActiveHandles performance
trevnorris Nov 11, 2015
89f056b
node: improve performance of hrtime()
trevnorris Nov 11, 2015
ecef817
node: improve accessor perf of process.env
trevnorris Nov 11, 2015
fcf632b
crypto: load PFX chain the same way as regular one
indutny Dec 5, 2015
82f74ca
test: fix flaky test-net-error-twice
mscdex Dec 18, 2015
d11930d
repl: use String#repeat instead of Array#join
evanlucas Nov 18, 2015
d265fc8
assert: typed array deepequal performance fix
claudiorodriguez Dec 17, 2015
8f7af9a
http: remove excess calls to removeSocket
Dec 6, 2015
3d41a44
repl: Fixed node repl history edge case.
zeusdeux Dec 1, 2015
ca97e72
https: use `servername` in agent key
indutny Dec 22, 2015
6d14b65
test: use platformTimeout() in more places
mscdex Dec 22, 2015
00b37de
test: fix domain-top-level-error-handler-throw
santigimeno Dec 20, 2015
57684d6
doc: improve addons.markdown copy
jasnell Dec 17, 2015
474a0f0
doc: improvements to buffer.markdown copy
jasnell Dec 20, 2015
8781c59
buffer: refactor create buffer
JacksonTian Dec 18, 2015
6d8053a
buffer: faster case for create Buffer from new Buffer(0)
JacksonTian Dec 17, 2015
6450d86
doc: improve grammar in tls docs
AdriVanHoudt Dec 16, 2015
c77fd68
http: 451 status code "Unavailable For Legal Reasons"
mbarinov Dec 21, 2015
71b79bc
test: test each block in addon.md contains js & cc
rvagg Dec 24, 2015
e79eda7
doc: copyedit releases.md
Trott Dec 21, 2015
8742090
test: fix http-response-multiheaders
santigimeno Nov 21, 2015
8c9d0c1
test: refactor test-net-connect-options-ipv6
Trott Dec 23, 2015
b5aaccc
lib: remove unused modules
Trott Dec 23, 2015
3710028
test: remove unused `util` imports
Trott Dec 23, 2015
65c40d7
repl: remove unused function
Trott Dec 23, 2015
0799a9a
test: remove unused var from test-assert.js
Trott Dec 23, 2015
cd79ec2
test: remove unnecessary assignments
Trott Dec 24, 2015
2526282
child_process: guard against race condition
Trott Dec 24, 2015
c639d0f
test: mark test-debug-no-context is flaky
Trott Dec 25, 2015
c835ba3
doc: improve assert.markdown copy
jasnell Dec 20, 2015
bc1c0dc
doc: catch the WORKING_GROUPS.md bootstrap docs up to date
jasnell Dec 20, 2015
c36ca37
test: remove unused variables form http tests
Trott Dec 25, 2015
585c01f
test: remove unused variables from TLS tests
Trott Dec 26, 2015
684eb32
test: remove unused variables from HTTPS tests
Trott Dec 26, 2015
03c4bc7
test: fix flaky child-process-fork-regr-gh-2847
mscdex Dec 27, 2015
715afc9
test: fix flaky cluster-net-send
mscdex Dec 28, 2015
e72112f
test: fix flaky cluster-disconnect-race
mscdex Dec 28, 2015
54004f0
test: remove unused vars in ChildProcess tests
Trott Dec 26, 2015
c6a99dd
test: remove unused variables from net tests
Trott Dec 26, 2015
14a947f
tools: run tick processor without forking
Dec 9, 2015
9e66735
doc: fix formatting in process.markdown
Trott Dec 27, 2015
b19d19e
test: extend timeout in Debug mode
Trott Dec 26, 2015
150f628
doc: copyedit setTimeout() documentation
Trott Dec 27, 2015
55c6946
test: make temp path customizable
jbergstroem Oct 12, 2015
5110e4d
test: don't assume a certain folder structure
jbergstroem Dec 30, 2015
ba24450
test: don't use cwd for relative path
jbergstroem Dec 30, 2015
ffb4a6e
http: fix non-string header value concatenation
mscdex Dec 28, 2015
c1bc9a1
doc: improve child_process.markdown copy
jasnell Dec 21, 2015
e177cc9
doc: improvements to console.markdown copy
jasnell Dec 26, 2015
ed15962
doc: improvements to dns.markdown copy
jasnell Dec 27, 2015
ccd75fe
doc: improvements to events.markdown copy
jasnell Dec 29, 2015
083ae16
http: use `self.keepAlive` instead of `self.options.keepAlive`
dschenkelman Dec 23, 2015
e8bbeec
doc: improvements to debugger.markdown copy
jasnell Dec 27, 2015
ec0b636
test: remove unused assert module imports
Trott Dec 27, 2015
f68f86c
test: fix race condition in test-http-client-onerror
Dec 18, 2015
5a223d6
doc: add anchors for _transform _flush _writev in stream.markdown
iamchenxin Dec 28, 2015
8039ca0
util: faster arrayToHash
JacksonTian Nov 22, 2015
40076bf
doc: fix spelling error in lib/url.js comment
nikolas Dec 22, 2015
c745b4d
doc: explain ClientRequest#setTimeout time unit
bripkens Dec 28, 2015
eee5082
doc: mention that http.Server inherits from net.Server
ryansobol Dec 28, 2015
d46d850
test: shorten path for bogus socket
Trott Dec 30, 2015
921fb54
node: improve performance of process.hrtime()
evanlucas Dec 30, 2015
3bfc187
test: improve assert message
Trott Dec 29, 2015
08a3490
test: inherit JOBS from environment
jbergstroem Dec 31, 2015
f1a66bc
test: clarify role of domains in test
Trott Dec 31, 2015
06043fd
test: remove unused modules
Trott Dec 30, 2015
ab3e5c1
test: write to tmp dir rather than fixture dir
Trott Dec 30, 2015
02b3a5b
test: refactor test-fs-empty-readStream
Trott Dec 30, 2015
a703b1b
test: remove time check
Trott Dec 31, 2015
6c7bcd5
doc: fix website wg mislink
Dec 19, 2015
e57fd51
os: fix crash in GetInterfaceAddresses
martinbark Dec 14, 2015
69343d6
tls_wrap: clear errors on return
indutny Jan 3, 2016
6cdfa38
doc: improvements to errors.markdown copy
jasnell Dec 28, 2015
982f322
doc: improvements to dgram.markdown copy
jasnell Dec 27, 2015
e04a840
test: remove flaky designations for tests
Trott Jan 3, 2016
46fefbc
test: fix flaky test-http-agent-keepalive
Trott Jan 4, 2016
30b0d75
test: fix flaky streams test
Trott Jan 3, 2016
1dd2d01
http: handle errors on idle sockets
jfromaniello Dec 31, 2015
984db93
test: fix flaky test-cluster-shared-leak
Trott Jan 1, 2016
ae02466
test: remove unused vars from parallel tests
Trott Jan 2, 2016
2a69ab3
test: add test-domain-exit-dispose-again back
Dec 12, 2015
35aec4c
doc: fix numbering in stream.markdown
richardsun29 Jan 5, 2016
5be0259
doc: close backtick in process.title description
Jan 5, 2016
4b14f1c
test: remove unused vars
Trott Dec 27, 2015
386030b
tools: implement no-unused-vars for eslint
Trott Dec 23, 2015
334e739
doc: fix heading level error in Buffer doc
Jan 5, 2016
ca9812c
tools: fix warning in doc parsing
Jan 5, 2016
4220d25
test: fix linting for the v5.x branch
Fishrock123 Jan 6, 2016
af591d4
2016-01-06, Version 5.4.0 (Stable)
Fishrock123 Jan 6, 2016
138e1e5
Working on v5.4.1
Fishrock123 Jan 6, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
test: add test-domain-exit-dispose-again back
1c85849 "fixed"
test-domain-exit-dispose-again by changing its logic to test that
process.domain was cleared properly in case an error was thrown from a
timer's callback.

However, it became clear when reviewing a recent change that refactors
lib/timers.js that it was not quite the intention of the original test.
Thus, this change adds the original implementation of
test-domain-exit-dispose-again back, with comments that make its
implementation easier to understand.

It also preserve the changes made by
1c85849, but it moves them to a new
test file named test-timers-reset-process-domain-on-throw.js.

PR: #4256
PR-URL: #4256
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
  • Loading branch information
Julien Gilli authored and Fishrock123 committed Jan 6, 2016
commit 2a69ab32ece382a4ae3f4ba527ec5340f37501f4
99 changes: 68 additions & 31 deletions test/parallel/test-domain-exit-dispose-again.js
Original file line number Diff line number Diff line change
@@ -1,39 +1,76 @@
'use strict';
const common = require('../common');
const assert = require('assert');
const domain = require('domain');

// Use the same timeout value so that both timers' callbacks are called during
// the same invocation of the underlying native timer's callback (listOnTimeout
// in lib/timers.js).
setTimeout(err, 50);
setTimeout(common.mustCall(secondTimer), 50);
// This test makes sure that when a domain is disposed, timers that are
// attached to that domain are not fired, but timers that are _not_ attached
// to that domain, including those whose callbacks are called from within
// the same invocation of listOnTimeout, _are_ called.

function err() {
var common = require('../common');
var assert = require('assert');
var domain = require('domain');
var disposalFailed = false;

// Repeatedly schedule a timer with a delay different than the timers attached
// to a domain that will eventually be disposed to make sure that they are
// called, regardless of what happens with those timers attached to domains
// that will eventually be disposed.
var a = 0;
log();
function log() {
console.log(a++, process.domain);
if (a < 10) setTimeout(log, 20);
}

var secondTimerRan = false;

// Use the same timeout duration for both "firstTimer" and "secondTimer"
// callbacks so that they are called during the same invocation of the
// underlying native timer's callback (listOnTimeout in lib/timers.js).
const TIMEOUT_DURATION = 50;

setTimeout(function firstTimer() {
const d = domain.create();
d.on('error', handleDomainError);
d.run(err2);

function err2() {
// this function doesn't exist, and throws an error as a result.
d.on('error', function handleError(err) {
// Dispose the domain on purpose, so that we can test that nestedTimer
// is not called since it's associated to this domain and a timer whose
// domain is diposed should not run.
d.dispose();
console.error(err);
console.error('in domain error handler',
process.domain, process.domain === d);
});

d.run(function() {
// Create another nested timer that is by definition associated to the
// domain "d". Because an error is thrown before the timer's callback
// is called, and because the domain's error handler disposes the domain,
// this timer's callback should never run.
setTimeout(function nestedTimer() {
console.error('Nested timer should not run, because it is attached to ' +
'a domain that should be disposed.');
disposalFailed = true;
process.exit(1);
});

// Make V8 throw an unreferenced error. As a result, the domain's error
// handler is called, which disposes the domain "d" and should prevent the
// nested timer that is attached to it from running.
err3();
}
});
}, TIMEOUT_DURATION);

function handleDomainError(e) {
// In the domain's error handler, the current active domain should be the
// domain within which the error was thrown.
assert.equal(process.domain, d);
}
}
// This timer expires in the same invocation of listOnTimeout than firstTimer,
// but because it's not attached to any domain, it must run regardless of
// domain "d" being disposed.
setTimeout(function secondTimer() {
console.log('In second timer');
secondTimerRan = true;
}, TIMEOUT_DURATION);

function secondTimer() {
// secondTimer was scheduled before any domain had been created, so its
// callback should not have any active domain set when it runs.
// Do not use assert here, as it throws errors and if a domain with an error
// handler is active, then asserting wouldn't make the test fail.
if (process.domain !== null) {
console.log('process.domain should be null, but instead is:',
process.domain);
process.exit(1);
}
}
process.on('exit', function() {
assert.equal(a, 10);
assert.equal(disposalFailed, false);
assert(secondTimerRan);
console.log('ok');
});
45 changes: 45 additions & 0 deletions test/parallel/test-timers-reset-process-domain-on-throw.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
'use strict';

// This test makes sure that when throwing from within a timer's callback,
// its active domain at the time of the throw is not the process' active domain
// for the next timers that need to be processed on the same turn of the event
// loop.

const common = require('../common');
const assert = require('assert');
const domain = require('domain');

// Use the same timeout value so that both timers' callbacks are called during
// the same invocation of the underlying native timer's callback (listOnTimeout
// in lib/timers.js).
setTimeout(err, 50);
setTimeout(common.mustCall(secondTimer), 50);

function err() {
const d = domain.create();
d.on('error', handleDomainError);
d.run(err2);

function err2() {
// this function doesn't exist, and throws an error as a result.
err3();
}

function handleDomainError(e) {
// In the domain's error handler, the current active domain should be the
// domain within which the error was thrown.
assert.equal(process.domain, d);
}
}

function secondTimer() {
// secondTimer was scheduled before any domain had been created, so its
// callback should not have any active domain set when it runs.
if (process.domain !== null) {
console.log('process.domain should be null in this timer callback, but ' +
'instead is:', process.domain);
// Do not use assert here, as it throws errors and if a domain with an error
// handler is active, then asserting wouldn't make the test fail.
process.exit(1);
}
}