-
-
Notifications
You must be signed in to change notification settings - Fork 35.4k
async_hooks,async_wrap: fixups and fewer aborts #14722
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
Changes from 1 commit
f5ef678
0f863d0
f2c1638
14c3a5e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
v8::MaybeLocal::ToLocalChecked() will abort on an empty handle. AsyncWrap::MakeCallback returns an empty handle if the domain is disposed, but this should not cause the process to abort. So instead return v8::Undefined() and allow the error to be handled normally. PR-URL: #14722
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| 'use strict'; | ||
|
|
||
| const common = require('../common'); | ||
| const assert = require('assert'); | ||
| const domain = require('domain'); | ||
|
|
||
| // These were picked arbitrarily and are only used to trigger arync_hooks. | ||
| const JSStream = process.binding('js_stream').JSStream; | ||
| const Socket = require('net').Socket; | ||
|
|
||
| const handle = new JSStream(); | ||
| handle.domain = domain.create(); | ||
| handle.domain.dispose(); | ||
|
|
||
| handle.close = () => {}; | ||
| handle.isAlive = () => { throw new Error(); }; | ||
|
|
||
| const s = new Socket({ handle }); | ||
|
|
||
| // When AsyncWrap::MakeCallback() returned an empty handle the | ||
| // MaybeLocal::ToLocalChecked() call caused the process to abort. By returning | ||
| // v8::Undefined() it allows the error to propagate to the 'error' event. | ||
| s.on('error', common.mustCall((e) => { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What triggers this? the dispose on next tick?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The abort or the The abort is because we're currently returning
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @refack implementation details of how the |
||
| assert.strictEqual(e.code, 'EINVAL'); | ||
| })); | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please also take a look at #14697 when you get the chance.