summaryrefslogtreecommitdiff
path: root/src/node_watchdog.h
AgeCommit message (Collapse)Author
2019-11-28src: cleanup unused headersAlexandre Ferrando
Node codebase has evolved a lot in the more than 10 years of its existence. As more features (and code) have been added, changed, removed, it's sometimes hard to keep track of what gets used and what not. This commits attempts to clean some of those potentially left-over headers using suggestions from include-what-you-use Refs: https://github.com/nodejs/node/issues/27531 PR-URL: https://github.com/nodejs/node/pull/30328 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
2019-06-12src: do not use pointer for loop in node_watchdogAnna Henningsen
PR-URL: https://github.com/nodejs/node/pull/28020 Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
2019-05-16src: enable V8's WASM trap handlersGus Caplan
This uses SIGSEGV handlers to catch WASM out of bound (OOB) memory accesses instead of inserting OOB checks inline, resulting in a 25%-30% speed increase. Note that installing a custom SIGSEGV handler will break this, resulting in potentially scary behaviour. Refs: https://github.com/nodejs/node/issues/14927 PR-URL: https://github.com/nodejs/node/pull/27246 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
2019-02-08src: make watchdog async callback a lambdaGireesh Punathil
`Watchdog::Async` features only once for the async callback, so make it a lambda. PR-URL: https://github.com/nodejs/node/pull/25945 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2017-05-23vm: fix race condition with timeout paramMarcel Laverdet
This fixes a race condition in the watchdog timer used for vm timeouts. The condition would terminate the main stack's execution instead of the code running under the sandbox. PR-URL: https://github.com/nodejs/node/pull/13074 Reviewed-By: Anna Henningsen <anna@addaleax.net>
2017-03-10meta: restore original copyright headerJames M Snell
A prior io.js era commit inappropriately removed the original copyright statements from the source. This restores those in any files still remaining from that edit. Ref: https://github.com/nodejs/TSC/issues/174 Ref: https://github.com/nodejs/node/pull/10599 PR-URL: https://github.com/nodejs/node/pull/10155 Note: This PR was required, reviewed-by and approved by the Node.js Foundation Legal Committee and the TSC. There is no `Approved-By:` meta data.
2016-12-23watchdog: add flag to mark handler as disabledBartosz Sosnowski
Adds flags that marks WinCtrlCHandlerRoutine as disabled instead of removing it. Trying to remove the controller from the controller handle itself leads to deadlock. PR-URL: https://github.com/nodejs/node/pull/10248 Reviewed-By: Anna Henningsen <anna@addaleax.net>
2016-08-11test,util: fix flaky test-util-sigint-watchdogAnna Henningsen
Fix parallel/test-util-sigint-watchdog by polling until the signal has definitely been received instead of just using a timeout. Fixes: https://github.com/nodejs/node/issues/7919 PR-URL: https://github.com/nodejs/node/pull/7933 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2016-08-11src: use RAII for mutexes in node_watchdog.ccAnna Henningsen
PR-URL: https://github.com/nodejs/node/pull/7933 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2016-06-28src: fix whitespace/indent cpplint warningsBen Noordhuis
PR-URL: https://github.com/nodejs/node/pull/7462 Reviewed-By: Trevor Norris <trev.norris@gmail.com>
2016-06-28src: fix whitespace/blank_line cpplint warningsBen Noordhuis
PR-URL: https://github.com/nodejs/node/pull/7462 Reviewed-By: Trevor Norris <trev.norris@gmail.com>
2016-06-25vm: test for abort condition of current invocationAnna Henningsen
When a vm script aborted after a timeout/signal interruption, test whether the local timeout/signal watchdog was responsible for terminating the execution. Without this, when a shorter timer from an outer `vm.run*` invocation fires before an inner timeout, the inner timeout would throw an error instead of the outer one, but because it did not witness the timeout itself, it would assume the termination was the result of a signal interruption. PR-URL: https://github.com/nodejs/node/pull/7373 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2016-06-18vm: add ability to break on sigint/ctrl+cAnna Henningsen
- Adds the `breakEvalOnSigint` option to `vm.runIn(This)Context`. This uses a watchdog thread to wait for SIGINT and generally works just like the existing `timeout` option. - Adds a method to the existing timer-based watchdog to check if it stopped regularly or by running into the timeout. This is used to tell a SIGINT abort from a timer-based one. - Adds (internal) `process._{start,stop}SigintWatchdog` methods to start/stop the watchdog thread used by the above option manually. This will be used in the REPL to set up SIGINT handling before entering terminal raw mode, so that there is no time window in which Ctrl+C fully aborts the process. PR-URL: https://github.com/nodejs/node/pull/6635 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2016-05-25src: add include guards to internal headersBen Noordhuis
For consistency with the newly added src/base64.h header, check that NODE_WANT_INTERNALS is defined and set in internal headers. PR-URL: https://github.com/nodejs/node/pull/6948 Refs: https://github.com/nodejs/node/pull/6910 Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Trevor Norris <trev.norris@gmail.com>
2015-10-21vm: remove Watchdog dependency on EnvironmentIdo Ben-Yair
Remove the Watchdog class' dependency on Environment. No functional changes, only code cleanup. PR-URL: https://github.com/nodejs/node/pull/3274 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2015-01-12Remove excessive copyright/license boilerplateisaacs
The copyright and license notice is already in the LICENSE file. There is no justifiable reason to also require that it be included in every file, since the individual files are not individually distributed except as part of the entire package.
2014-06-12watchdog: terminate one specific isolateFedor Indutny
2014-04-07src: update uv callbacks after API changesSaúl Ibarra Corretgé
async, timer, prepare, idle and check handles no longer get a status parameter since they can never fail.
2013-12-18vm: fix race condition in timeoutAlexis Campailla
Eliminate a race condition between uv_async_send and the closing of the corresponding handle. Also made errors in Watchdog constructor call abort() Fixes #6088
2013-07-31src: lint c++ codeFedor Indutny
2013-05-30vm: fix race condition in watchdog cleanupAndrew Paprocki
Previous code was calling uv_loop_delete() directly on a running loop, which led to race condition aborts/segfaults within libuv. This change changes the watchdog thread to call uv_run() with UV_RUN_ONCE so that the call exits after either the timer times out or uv_async_send() is called from the main thread in Watchdog::Destroy(). The timer/async handles are then closed and uv_run() with UV_RUN_DEFAULT is called so that libuv has a chance to cleanup before the thread exits. The main thread meanwhile calls uv_thread_join() and then uv_loop_delete() to complete the cleanup.
2013-04-29vm: add support for timeout argumentAndrew Paprocki
Add a watchdog class which executes a timer in a separate event loop in a separate thread that will terminate v8 execution if it expires. Add timeout argument to functions in vm module which use the watchdog if a non-zero timeout is specified.