From 1d87704f6a680b74b6fa187646c5be4d2fc91e8c Mon Sep 17 00:00:00 2001 From: MarcZX10 <67475268+MarcZX10@users.noreply.github.com> Date: Mon, 2 Nov 2026 23:38:48 +0000 Subject: [PATCH] fix(libkernel): catch host watch thread errors instead of terminating The EVFILT_VNODE host watch thread in AddVnodeEvent ran RunHostWatch directly. RunHostWatch throws std::runtime_error on poll, inotify, kqueue or change-notification failures, and an exception escaping a detached std::thread calls std::terminate and aborts the whole process. The thread entry now catches std::exception, reports the message on stderr and ends the watch, which RunHostWatch has already closed on every throw path. --- core/libs/prx/libkernel/Equeue/src/FileEvent.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/core/libs/prx/libkernel/Equeue/src/FileEvent.cpp b/core/libs/prx/libkernel/Equeue/src/FileEvent.cpp index ba078db53b..e7fab097d3 100644 --- a/core/libs/prx/libkernel/Equeue/src/FileEvent.cpp +++ b/core/libs/prx/libkernel/Equeue/src/FileEvent.cpp @@ -7,6 +7,7 @@ #include #include #include +#include #include #include #include @@ -770,7 +771,14 @@ int AddVnodeEvent(const KernelEqueueRef& queue, int descriptor, std::uint32_t ff CloseHostWatch(host); return result == EQUEUE_OK ? 0 : result & 0xffff; } - std::thread(RunHostWatch, watch, std::move(host)).detach(); + std::thread([watch, host = std::move(host)]() mutable { + try { + RunHostWatch(watch, std::move(host)); + } catch (const std::exception& error) { + std::fprintf(stderr, "%s\n", error.what()); + std::fflush(stderr); + } + }).detach(); return 0; }