diff options
author | Yash Ladha <yashladhapankajladha123@gmail.com> | 2020-11-24 05:56:56 +0300 |
---|---|---|
committer | Antoine du Hamel <duhamelantoine1995@gmail.com> | 2021-03-19 17:16:01 +0300 |
commit | 65e8864fa39fb51250d63212548807589cba08f3 (patch) | |
tree | 4c7fa4a0fb222f9fe1ecb795cb41decf6ebe9bb7 /src/node_worker.cc | |
parent | 361632dab1eb57c55fae17d2fcb11b3000036661 (diff) |
worker: send correct error status for worker init
When the worker is created, in case of failure when a separate isolate
is not able to get created, we tend to throw out of memory error for
that worker which is not the case. Correct error code as per semantic
should be thrown which is in our case is `ERR_WORKER_INIT_FAILED`.
PR-URL: https://github.com/nodejs/node/pull/36242
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Diffstat (limited to 'src/node_worker.cc')
-rw-r--r-- | src/node_worker.cc | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/src/node_worker.cc b/src/node_worker.cc index 15dea5c501b..43a3862cc69 100644 --- a/src/node_worker.cc +++ b/src/node_worker.cc @@ -150,9 +150,7 @@ class WorkerThreadData { Isolate* isolate = Isolate::Allocate(); if (isolate == nullptr) { - // TODO(addaleax): This should be ERR_WORKER_INIT_FAILED, - // ERR_WORKER_OUT_OF_MEMORY is for reaching the per-Worker heap limit. - w->Exit(1, "ERR_WORKER_OUT_OF_MEMORY", "Failed to create new Isolate"); + w->Exit(1, "ERR_WORKER_INIT_FAILED", "Failed to create new Isolate"); return; } @@ -298,9 +296,7 @@ void Worker::Run() { TryCatch try_catch(isolate_); context = NewContext(isolate_); if (context.IsEmpty()) { - // TODO(addaleax): This should be ERR_WORKER_INIT_FAILED, - // ERR_WORKER_OUT_OF_MEMORY is for reaching the per-Worker heap limit. - Exit(1, "ERR_WORKER_OUT_OF_MEMORY", "Failed to create new Context"); + Exit(1, "ERR_WORKER_INIT_FAILED", "Failed to create new Context"); return; } } |