summaryrefslogtreecommitdiff
path: root/src/async_wrap-inl.h
Commit message (Collapse)AuthorAgeFilesLines
* src: Handle bad callback in asyc_wrapHarshitha KP2020-03-051-3/+2
| | | | | | | | Align with the MaybeLocal<> API contract PR-URL: https://github.com/nodejs/node/pull/31946 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com>
* src: remove AsyncScope and AsyncCallbackScopeAnna Henningsen2019-11-061-14/+0
| | | | | | | | | | Reduce the number of different scopes we use for async callbacks. PR-URL: https://github.com/nodejs/node/pull/30236 Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com> Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: David Carlier <devnexen@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
* src: do not reuse async resource in http parsersDaniel Beckert2019-04-221-0/+5
| | | | | | | | | | | | | | | | | Change resource being used, previously HTTParser was being reused. We are now using IncomingMessage and ClientRequest objects. The goal here is to make the async resource unique for each async operatio Refs: https://github.com/nodejs/node/pull/24330 Refs: https://github.com/nodejs/diagnostics/issues/248 Refs: https://github.com/nodejs/node/pull/21313 Co-authored-by: Matheus Marchini <mat@mmarchini.me> PR-URL: https://github.com/nodejs/node/pull/25094 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Benedikt Meurer <benedikt.meurer@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
* src: move AsyncHooks out of EnvironmentJoyee Cheung2019-03-271-6/+4
| | | | | | | PR-URL: https://github.com/nodejs/node/pull/26824 Refs: https://github.com/nodejs/node/issues/26776 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com>
* src: do proper error checking in `AsyncWrap::MakeCallback`Anna Henningsen2018-06-141-12/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | At least one method on a native object is added as a getter, namely `MessagePort.prototype.onmessage`. When a MessagePort attempts to call this method from C++ in response to receiving data, it will first invoke that getter and then call the function. Since `worker.terminate()` interrupts execution, this means that the getter may fail (without being faulty code on its own). This means that at least one test exercising these methods in combination has been flaky and could have crashed, because we did not actually check that the getter returns a value so far, resulting in dereferencing an empty `Local`. The proper fix for this is to use the non-deprecated overload of `Get()` and check the result like we should be doing. Also, as a (related) fix, don’t crash if the method is not a function but rather something else, like a getter could provide. Example test failure: https://ci.nodejs.org/job/node-test-commit-linux-containered/4976/nodes=ubuntu1604_sharedlibs_zlib_x64/console 17:56:56 not ok 1955 parallel/test-worker-dns-terminate 17:56:56 --- 17:56:56 duration_ms: 1.237 17:56:56 severity: crashed 17:56:56 exitcode: -11 17:56:56 stack: |- PR-URL: https://github.com/nodejs/node/pull/21189 Reviewed-By: Anatoli Papirovski <apapirovski@mac.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
* src: make handle onclose property a SymbolAnna Henningsen2018-06-061-0/+16
| | | | | | | | | | | | | | This makes the property “more” hidden when exposing a `HandleWrap` as public API, e.g. for upcoming `MessagePort`s. PR-URL: https://github.com/nodejs/node/pull/20876 Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Shingo Inoue <leko.noor@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com> Reviewed-By: John-David Dalton <john.david.dalton@gmail.com> Reviewed-By: Gus Caplan <me@gus.host>
* src: move v8::HandleScope call to EmitUjjwal Sharma2018-04-201-2/+0
| | | | | | | | | | | | | | | | Move v8::HandleScope call to Emit removing it from previous locations where it was added to avoid crashing (constructor and destructor of AsyncWrap) for a more general and fool-proof solution. Ref: https://github.com/nodejs/node/pull/19972#issuecomment-381353894 PR-URL: https://github.com/nodejs/node/pull/20045 Reviewed-By: Yang Guo <yangguo@chromium.org> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
* src: add HandleScope to fix errorUjjwal Sharma2018-04-141-0/+2
| | | | | | | | | | | | Add `HandleError`s to the AsyncScope constructor and destructor in async_wrap-inl.h to fix "FATAL ERROR" incurring observed while running test-http2-respond-with-file using the --trace-events-enabled flag. Fixes: https://github.com/nodejs/node/issues/19921 PR-URL: https://github.com/nodejs/node/pull/19972 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com>
* src: add helper for before/after scope without JS callsAnna Henningsen2018-03-151-0/+16
| | | | | | | | | | | Add `AsyncScope` for cases where the async_hooks `before` and `after` callbacks should be called, to track async context, but no actual JS is called in between and we can therefore skip things like draining the microtask or `nextTick` queues. PR-URL: https://github.com/nodejs/node/pull/18936 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
* src: add convenience ctor for async trigger id scopeAnna Henningsen2018-03-111-0/+7
| | | | | | | PR-URL: https://github.com/nodejs/node/pull/19204 Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
* src: rename base-object -> base_objectDaniel Bevenius2017-11-171-1/+1
| | | | | | | | | | This commit renames base-object to base_object for consitency with other c++ source files. PR-URL: https://github.com/nodejs/node/pull/17022 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
* src: rename async-wrap -> async_wrapDaniel Bevenius2017-11-171-0/+71
This commit renames async-wrap to async_wrap for consitency with other c++ source files. PR-URL: https://github.com/nodejs/node/pull/17022 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>