GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — worker: runtime error on pthread creation · jmdfm/node@b6459ec

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • src
    • node_errors.h
    • node_worker.cc
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎src/node_errors.h‎

Copy file name to clipboardExpand all lines: src/node_errors.h
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ void OnFatalError(const char* location, const char* message);
5858
V(ERR_TRANSFERRING_EXTERNALIZED_SHAREDARRAYBUFFER, TypeError) \
5959
V(ERR_TLS_PSK_SET_IDENTIY_HINT_FAILED, Error) \
6060
V(ERR_VM_MODULE_CACHED_DATA_REJECTED, Error) \
61+
V(ERR_WORKER_INIT_FAILED, Error) \
6162
V(ERR_PROTO_ACCESS, Error)
6263

6364
#define V(code, type) \
@@ -107,6 +108,7 @@ void OnFatalError(const char* location, const char* message);
107108
V(ERR_TRANSFERRING_EXTERNALIZED_SHAREDARRAYBUFFER, \
108109
"Cannot serialize externalized SharedArrayBuffer") \
109110
V(ERR_TLS_PSK_SET_IDENTIY_HINT_FAILED, "Failed to set PSK identity hint") \
111+
V(ERR_WORKER_INIT_FAILED, "Worker initialization failure") \
110112
V(ERR_PROTO_ACCESS, \
111113
"Accessing Object.prototype.__proto__ has been " \
112114
"disallowed with --disable-proto=throw")
Collapse file

‎src/node_worker.cc‎

Copy file name to clipboardExpand all lines: src/node_worker.cc
+18-2Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -602,7 +602,7 @@ void Worker::StartThread(const FunctionCallbackInfo<Value>& args) {
602602
uv_thread_options_t thread_options;
603603
thread_options.flags = UV_THREAD_HAS_STACK_SIZE;
604604
thread_options.stack_size = kStackSize;
605-
CHECK_EQ(uv_thread_create_ex(&w->tid_, &thread_options, [](void* arg) {
605+
int ret = uv_thread_create_ex(&w->tid_, &thread_options, [](void* arg) {
606606
// XXX: This could become a std::unique_ptr, but that makes at least
607607
// gcc 6.3 detect undefined behaviour when there shouldn't be any.
608608
// gcc 7+ handles this well.
@@ -623,7 +623,23 @@ void Worker::StartThread(const FunctionCallbackInfo<Value>& args) {
623623
w->JoinThread();
624624
// implicitly delete w
625625
});
626-
}, static_cast<void*>(w)), 0);
626+
}, static_cast<void*>(w));
627+
if (ret != 0) {
628+
char err_buf[128];
629+
uv_err_name_r(ret, err_buf, sizeof(err_buf));
630+
w->custom_error_ = "ERR_WORKER_INIT_FAILED";
631+
w->custom_error_str_ = err_buf;
632+
w->loop_init_failed_ = true;
633+
w->thread_joined_ = true;
634+
w->stopped_ = true;
635+
w->env()->remove_sub_worker_context(w);
636+
{
637+
Isolate* isolate = w->env()->isolate();
638+
HandleScope handle_scope(isolate);
639+
THROW_ERR_WORKER_INIT_FAILED(isolate, err_buf);
640+
}
641+
w->MakeWeak();
642+
}
627643
}
628644

629645
void Worker::StopThread(const FunctionCallbackInfo<Value>& args) {

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.