Title: worker_threads Worker exit aborts (SIGABRT) when a native addon (fsevents) has an in-flight napi_threadsafe_function — napi_release_threadsafe_function / uv_mutex_lock · Issue #65100 · nodejs/node · GitHub
Open Graph Title: worker_threads Worker exit aborts (SIGABRT) when a native addon (fsevents) has an in-flight napi_threadsafe_function — napi_release_threadsafe_function / uv_mutex_lock · Issue #65100 · nodejs/node
X Title: worker_threads Worker exit aborts (SIGABRT) when a native addon (fsevents) has an in-flight napi_threadsafe_function — napi_release_threadsafe_function / uv_mutex_lock · Issue #65100 · nodejs/node
Description: Version v24.15.0 through v24.19.0 (tested v24.15.0, v24.16.0, v24.19.0 — all crash). Does NOT reproduce on v24.11.0 or v24.11.1. Platform macOS 15.6.1 (24G90), Apple Silicon (arm64) Subsystem worker_threads, N-API (napi_threadsafe_functi...
Open Graph Description: Version v24.15.0 through v24.19.0 (tested v24.15.0, v24.16.0, v24.19.0 — all crash). Does NOT reproduce on v24.11.0 or v24.11.1. Platform macOS 15.6.1 (24G90), Apple Silicon (arm64) Subsystem worke...
X Description: Version v24.15.0 through v24.19.0 (tested v24.15.0, v24.16.0, v24.19.0 — all crash). Does NOT reproduce on v24.11.0 or v24.11.1. Platform macOS 15.6.1 (24G90), Apple Silicon (arm64) Subsystem worke...
Opengraph URL: https://github.com/nodejs/node/issues/65100
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"worker_threads Worker exit aborts (SIGABRT) when a native addon (fsevents) has an in-flight napi_threadsafe_function — napi_release_threadsafe_function / uv_mutex_lock","articleBody":"### Version\nv24.15.0 through v24.19.0 (tested v24.15.0, v24.16.0, v24.19.0 — all crash).\nDoes NOT reproduce on v24.11.0 or v24.11.1.\n\n### Platform\nmacOS 15.6.1 (24G90), Apple Silicon (arm64)\n\n### Subsystem\nworker_threads, N-API (napi_threadsafe_function)\n\n### What steps will reproduce the bug?\n\nMinimal repro repo: https://github.com/mastoj/node24-fsevents-worker-threads-abort\n\n1. `npm install`\n2. `node main.mjs 50`\n\n`main.mjs` spawns 50 `worker_threads.Worker`s sequentially. Each worker\n(`worker.mjs`) does:\n\n```js\nimport { createRequire } from \"node:module\";\nconst require = createRequire(import.meta.url);\nconst fsevents = require(\"fsevents\");\n\nfsevents.watch(process.argv[2], () => {});\n\nsetTimeout(() => process.exit(0), 5);\n```\n\ni.e. it starts a native `fsevents` watch (which registers a\n`napi_threadsafe_function` under the hood) and exits the worker shortly\nafter, without explicitly stopping the watcher first.\n\n### How often does it reproduce? Is there a required condition?\n\n100% reproducible on Node.js v24.15.0+ on macOS. Crashes on the very first\nworker. 0% reproducible on Node.js v24.11.0/v24.11.1 (ran 50 workers cleanly).\n\n### What is the expected behavior?\n\nAll workers start, watch, and exit cleanly with code 0:\n```\nworker 0 exited with code 0\n...\nworker 49 exited with code 0\ndone, no crash across 50 workers\n```\n(This is what actually happens on v24.11.0.)\n\n### What do you see instead?\n\nThe whole process aborts with SIGABRT (exit code 134) on the very first\nworker — before any of the `console.log` lines are even printed, since the\nabort takes down the entire process (all worker threads share one OS\nprocess).\n\n```\n$ node main.mjs 50\nAbort trap: 6\n$ echo $?\n134\n```\n\nmacOS crash reporter consistently shows the same stack trace on the\n\"WorkerThread\":\n\n```\n__pthread_kill\npthread_kill\nabort\nuv_mutex_lock\nnapi_release_threadsafe_function\nfse_instance_destroy\nnapi_env__::CallIntoModule\u003c...>\nnode_napi_env__::CallFinalizer(void (*)(napi_env__*, void*, void*), void*, void*)\nv8impl::Reference::Finalize()\nnode_napi_env__::DeleteMe()\nnode::Environment::CloseHandle\u003c...>\nuv_run\nnode::Environment::RunCleanup()\nnode::FreeEnvironment(node::Environment*)\nnode::worker::Worker::Run()\nnode::worker::Worker::StartThread(...)::$_0::__invoke(void*)\n_pthread_start\nthread_start\n```\n\ni.e. during worker-thread `Environment` teardown, `napi_release_threadsafe_function`\nattempts `uv_mutex_lock` while finalizing `fsevents`' native threadsafe\nfunction, and this ends in `abort()` instead of a clean/graceful teardown.\n\n### Additional context\n\nThis was originally found as a crash inside a real-world Next.js 16.3.0\nmonorepo build (`next build --turbopack`), where Next's build worker threads\ntransitively load `fsevents` (via `chokidar`/`watchpack`) and exit shortly\nafter doing their work. The exact same crash signature (same stack trace)\nwas observed across 15+ independent crash reports collected via macOS's\ncrash reporter during real builds, before being reduced to this minimal,\nNext.js-free, `fsevents`-only reproduction.\n\nIt doesn't reproduce in a fresh `create-next-app` project (which doesn't\nhappen to have an active `fsevents` watcher inside its build workers) —\nonly projects where a native addon with an in-flight\n`napi_threadsafe_function` is active in a worker thread at worker-exit\ntime.","author":{"url":"https://github.com/mastoj","@type":"Person","name":"mastoj"},"datePublished":"2026-08-07T10:17:29Z","url":"https://github.com/nodejs/node/issues/65100"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:41667bb2-2cad-86d9-d126-e5670eb40656 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D74E:2C75BB:42FDED:5AC759:6AFBED20 |
| html-safe-nonce | 373048ddd86cac072c7c98c125cd8bc855a97b5bf966d37b3d6d78e1468de277 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJENzRFOjJDNzVCQjo0MkZERUQ6NUFDNzU5OjZBRkJFRDIwIiwidmlzaXRvcl9pZCI6IjQyNTUyNTEyMjg0MDI2NDIyMDkiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | d00de0576e141d79ab31d24b4918ebd3711ef2aeb346baa5b47489b8b80b70f8 |
| hovercard-subject-tag | issue:5089136508 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/nodejs/node/65100/issue_layout |
| twitter:image | https://opengraph.githubassets.com/4edf0c24ed305feae99c9d009e6d7573de57d134f25db6ed5065137f6f4c1e4b/nodejs/node/issues/65100 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/4edf0c24ed305feae99c9d009e6d7573de57d134f25db6ed5065137f6f4c1e4b/nodejs/node/issues/65100 |
| og:image:alt | Version v24.15.0 through v24.19.0 (tested v24.15.0, v24.16.0, v24.19.0 — all crash). Does NOT reproduce on v24.11.0 or v24.11.1. Platform macOS 15.6.1 (24G90), Apple Silicon (arm64) Subsystem worke... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | mastoj |
| hostname | github.com |
| expected-hostname | github.com |
| None | fa74413a1d84dac536fcca0740780bcbd3207bafec0e51873b73ff8e8cca032f |
| turbo-cache-control | no-preview |
| go-import | github.com/nodejs/node git https://github.com/nodejs/node.git |
| octolytics-dimension-user_id | 9950313 |
| octolytics-dimension-user_login | nodejs |
| octolytics-dimension-repository_id | 27193779 |
| octolytics-dimension-repository_nwo | nodejs/node |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 27193779 |
| octolytics-dimension-repository_network_root_nwo | nodejs/node |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | b3b5633a74535d9c23385512d534c66c8fde1907 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width