GeezerVison is showing github.com — worker: runtime error on pthread creation · nodejs/node@833d78a
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: src/node_errors.h +2Lines changed: 2 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -58,6 +58,7 @@ void OnFatalError(const char* location, const char* message); | 58 | 58 | V(ERR_TRANSFERRING_EXTERNALIZED_SHAREDARRAYBUFFER, TypeError) \ | 59 | 59 | V(ERR_TLS_PSK_SET_IDENTIY_HINT_FAILED, Error) \ | 60 | 60 | V(ERR_VM_MODULE_CACHED_DATA_REJECTED, Error) \ | | 61 | + V(ERR_WORKER_INIT_FAILED, Error) \ | 61 | 62 | V(ERR_PROTO_ACCESS, Error) | 62 | 63 |
| 63 | 64 | #define V(code, type) \ | @@ -107,6 +108,7 @@ void OnFatalError(const char* location, const char* message); | 107 | 108 | V(ERR_TRANSFERRING_EXTERNALIZED_SHAREDARRAYBUFFER, \ | 108 | 109 | "Cannot serialize externalized SharedArrayBuffer") \ | 109 | 110 | V(ERR_TLS_PSK_SET_IDENTIY_HINT_FAILED, "Failed to set PSK identity hint") \ | | 111 | + V(ERR_WORKER_INIT_FAILED, "Worker initialization failure") \ | 110 | 112 | V(ERR_PROTO_ACCESS, \ | 111 | 113 | "Accessing Object.prototype.__proto__ has been " \ | 112 | 114 | "disallowed with --disable-proto=throw") | |
Collapse file Copy file name to clipboardExpand all lines: src/node_worker.cc +18-2Lines changed: 18 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -623,7 +623,7 @@ void Worker::StartThread(const FunctionCallbackInfo<Value>& args) { | 623 | 623 | uv_thread_options_t thread_options; | 624 | 624 | thread_options.flags = UV_THREAD_HAS_STACK_SIZE; | 625 | 625 | thread_options.stack_size = kStackSize; | 626 | | - CHECK_EQ(uv_thread_create_ex(&w->tid_, &thread_options, [](void* arg) { | | 626 | + int ret = uv_thread_create_ex(&w->tid_, &thread_options, [](void* arg) { | 627 | 627 | // XXX: This could become a std::unique_ptr, but that makes at least | 628 | 628 | // gcc 6.3 detect undefined behaviour when there shouldn't be any. | 629 | 629 | // gcc 7+ handles this well. | @@ -644,7 +644,23 @@ void Worker::StartThread(const FunctionCallbackInfo<Value>& args) { | 644 | 644 | w->JoinThread(); | 645 | 645 | // implicitly delete w | 646 | 646 | }); | 647 | | - }, static_cast<void*>(w)), 0); | | 647 | + }, static_cast<void*>(w)); | | 648 | + if (ret != 0) { | | 649 | + char err_buf[128]; | | 650 | + uv_err_name_r(ret, err_buf, sizeof(err_buf)); | | 651 | + w->custom_error_ = "ERR_WORKER_INIT_FAILED"; | | 652 | + w->custom_error_str_ = err_buf; | | 653 | + w->loop_init_failed_ = true; | | 654 | + w->thread_joined_ = true; | | 655 | + w->stopped_ = true; | | 656 | + w->env()->remove_sub_worker_context(w); | | 657 | + { | | 658 | + Isolate* isolate = w->env()->isolate(); | | 659 | + HandleScope handle_scope(isolate); | | 660 | + THROW_ERR_WORKER_INIT_FAILED(isolate, err_buf); | | 661 | + } | | 662 | + w->MakeWeak(); | | 663 | + } | 648 | 664 | } | 649 | 665 |
| 650 | 666 | void Worker::StopThread(const FunctionCallbackInfo<Value>& args) { | |
|