diff options
author | Anna Henningsen <anna@addaleax.net> | 2019-02-05 23:51:28 +0300 |
---|---|---|
committer | Anna Henningsen <anna@addaleax.net> | 2019-02-13 23:36:24 +0300 |
commit | a80b29b38a66cec456e4ec73fb8030f45d186005 (patch) | |
tree | ad44198e7620505db311cdc99f689b6d7f7a058b /src/node_worker.h | |
parent | da0dc51e396ea4a1f12f259a8149f4177ad674e8 (diff) |
worker: set stack size for worker threads
This is so we can inform V8 about a known limit for the stack.
Otherwise, on some systems recursive functions may lead to
segmentation faults rather than “safe” failures.
PR-URL: https://github.com/nodejs/node/pull/26049
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Diffstat (limited to 'src/node_worker.h')
-rw-r--r-- | src/node_worker.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/node_worker.h b/src/node_worker.h index 4d7a7335ca6..68848c85999 100644 --- a/src/node_worker.h +++ b/src/node_worker.h @@ -80,6 +80,12 @@ class Worker : public AsyncWrap { bool thread_joined_ = true; int exit_code_ = 0; uint64_t thread_id_ = -1; + uintptr_t stack_base_; + + // Full size of the thread's stack. + static constexpr size_t kStackSize = 4 * 1024 * 1024; + // Stack buffer size that is not available to the JS engine. + static constexpr size_t kStackBufferSize = 192 * 1024; std::unique_ptr<MessagePortData> child_port_data_; |