mirror of
https://github.com/stablyai/orca.git
synced 2026-10-30 16:47:34 +00:00
Builds the macOS terminal host's Node 24.22.1 from pinned source with a libuv patch: idle threadpool workers recheck for queued work every 30 s instead of waiting forever, so a lost Darwin condition-variable wake-up (libuv #5280) no longer strands terminal I/O. Bumps the daemon protocol to v52 so new terminals start on the patched runtime right after an update; older daemons stay attachable. Adds stalled/recovered daemon async-I/O telemetry, and lets release workflows rebuild older refs that predate the source build. Fixes STA-11709, #31926.
47 lines
1.1 KiB
Diff
47 lines
1.1 KiB
Diff
--- a/deps/uv/src/threadpool.c
|
|
+++ b/deps/uv/src/threadpool.c
|
|
@@ -26,6 +26,9 @@
|
|
#endif
|
|
|
|
#include <stdlib.h>
|
|
+#if defined(__APPLE__) && defined(__MACH__)
|
|
+# include <errno.h>
|
|
+#endif
|
|
|
|
#define MAX_THREADPOOL_SIZE 1024
|
|
|
|
@@ -51,6 +54,24 @@
|
|
}
|
|
|
|
|
|
+static void wait_for_work(void) {
|
|
+#if defined(__APPLE__) && defined(__MACH__)
|
|
+ /* Bound idle waits so Darwin psynch lost wakeups can recover. */
|
|
+ const struct timespec timeout = { 30, 0 };
|
|
+ int r;
|
|
+
|
|
+ errno = 0;
|
|
+ r = pthread_cond_timedwait_relative_np(&cond, &mutex, &timeout);
|
|
+ /* Preserve uv_cond_wait's EINVAL/EBUSY workaround for Darwin. */
|
|
+ if (r == 0 || r == ETIMEDOUT || (r == EINVAL && errno == EBUSY))
|
|
+ return;
|
|
+ abort();
|
|
+#else
|
|
+ uv_cond_wait(&cond, &mutex);
|
|
+#endif
|
|
+}
|
|
+
|
|
+
|
|
/* To avoid deadlock with uv_cancel() it's crucial that the worker
|
|
* never holds the global mutex and the loop-local mutex at the same time.
|
|
*/
|
|
@@ -74,7 +95,7 @@
|
|
uv__queue_next(&run_slow_work_message) == &wq &&
|
|
slow_io_work_running >= slow_work_thread_threshold())) {
|
|
idle_threads += 1;
|
|
- uv_cond_wait(&cond, &mutex);
|
|
+ wait_for_work();
|
|
idle_threads -= 1;
|
|
}
|
|
|