-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix nexttick exception #11
Conversation
Good catch, but this is not the correct fix. The timing is wrong and we can't change the throw origin. Just add a check for |
I understand there should not be an explicit catch part. But the reason to invoke |
Look at the timing test, you made the following changes: @@ -40,7 +40,7 @@ process.once('exit', function () {
assert.strictEqual(throwFlag, true);
assert.deepEqual(eventOrder, [
'init#-1 NextTickWrap', 'pre#-1',
- 'callback', 'exception',
- 'post#-1', 'destroy#-1'
+ 'callback',
+ 'post#-1', 'destroy#-1', 'exception'
]);
}); The timing you implemented is not correct, because the To implement this in JS I delay |
I made some improvements that passed the original test. |
BTW. I suppose the moment the proposal changes in node-eps land in a stable release of node, |
I would like to not mess with |
Well, the definition is quite ambiguous. |
@AndreasMadsen I am stuck in a problem relating to the HTTPParser. I understand this is not a problem about |
I have tested it using the current AsyncWrap implementation. As expected the The test case: 'use strict';
const asyncHook = require('./');
const assert = require('assert');
const fs = require('fs');
asyncHook.addHooks({
init: function (uid, handle) {
process._rawDebug(`init#${uid} ${handle.constructor.name}`);
},
pre: function (uid) {
process._rawDebug(`pre#${uid}`);
},
post: function (uid, handle, didThrow) {
process._rawDebug(`post#${uid}`);
},
destroy: function (uid) {
process._rawDebug(`destroy#${uid}`);
}
});
asyncHook.enable();
/*
process.once('uncaughtException', function () {
process._rawDebug('exception');
});
*/
fs.access(__filename, function () {
process._rawDebug('callback');
throw new Error('error');
});
asyncHook.disable(); without
with
|
I got it.... |
Great, do you want to fix |
@AndreasMadsen Ok, I will take some time to fix it. BTW, my colleagues and I are attending Velocity conference held in NYC around Sept. 22th. I am wondering if we could meet some guys of Node.js team members in NYC. |
Thanks. I will make the final review later. Most likely I will just fix the nits myself, if that is ok.
No idea, I live in Denmark. You should should ask on Twitter and https://github.com/nodejs/diagnostics/. |
OK. That's fine. |
Exceptions should be thrown and process shall exit if there is no listener for
uncaughtException
event.I modified the way we run
post
�anddestroy
hooks after an exception happens during next tick.