Title: ffi: closed library still callable via fast path, SIGSEGV instead of ERR_FFI_LIBRARY_CLOSED · Issue #64854 · nodejs/node · GitHub
Open Graph Title: ffi: closed library still callable via fast path, SIGSEGV instead of ERR_FFI_LIBRARY_CLOSED · Issue #64854 · nodejs/node
X Title: ffi: closed library still callable via fast path, SIGSEGV instead of ERR_FFI_LIBRARY_CLOSED · Issue #64854 · nodejs/node
Description: Node.js JavaScript runtime ✨🐢🚀✨. Contribute to nodejs/node development by creating an account on GitHub.
Open Graph Description: Node.js JavaScript runtime ✨🐢🚀✨. Contribute to nodejs/node development by creating an account on GitHub.
X Description: Node.js JavaScript runtime ✨🐢🚀✨. Contribute to nodejs/node development by creating an account on GitHub.
Opengraph URL: https://github.com/nodejs/node
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"ffi: closed library still callable via fast path, SIGSEGV instead of ERR_FFI_LIBRARY_CLOSED","articleBody":"### Version\n\nmain\n\n### Platform\n\n```text\nN/A\n```\n\n### Subsystem\n\nffi\n\n### What steps will reproduce the bug?\n\n`repro.c`\n```c\ndouble multiply_f64(double a, double b) {\n return a * b;\n}\n```\n\nCompile it with\n```sh\n$ cc -shared -fPIC -o repro.so repro.c # macOS: -o repro.dylib\n```\n\n`repro.js`\n```js\nimport { dlopen, suffix } from 'node:ffi';\n\nconst { lib, functions } = dlopen(`./repro.${suffix}`, {\n multiply_f64: { arguments: ['f64', 'f64'], return: 'f64' },\n});\n\nfunction hot(a, b) { return functions.multiply_f64(a, b); }\n\n%PrepareFunctionForOptimization(hot);\nhot(2, 3);\n%OptimizeFunctionOnNextCall(hot);\n\nconsole.log('pre-close:', hot(2, 3)); // 6, now through the trampoline\n\nlib.close();\n\nconsole.log('after close:', hot(2, 3)); // SIGSEGV\n```\n\nRun it with\n```sh\n$ node --no-warnings --experimental-ffi --allow-natives-syntax repro.js\n```\n\n### How often does it reproduce? Is there a required condition?\n\nAlways\n\n### What is the expected behavior? Why is that the expected behavior?\n\nThe call after `close()` throws `ERR_FFI_LIBRARY_CLOSED`\n\n### What do you see instead?\n\n```console\npre-close: 6\nzsh: segmentation fault (core dumped)\n```\n\nThe call after `close()` throws `segmentation fault`\n\n### Additional information\n\n_No response_","author":{"url":"https://github.com/trivikr","@type":"Person","name":"trivikr"},"datePublished":"2026-07-31T01:32:07Z","url":"https://github.com/nodejs/node/issues/64854"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react-reconciler,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@d5750093facf |
| route-pattern | /:user_id/:repository/issues/:id(.:format) |
| route-controller | issues |
| route-action | show |
| fetch-nonce | v2:bc1f11cf-97d5-6e56-a8e5-ef4c803a2670 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B930:1258EF:64B75A:82EFF3:6AED2C98 |
| html-safe-nonce | 0e09612f1f16f21bc71c5a8d9d18ff033e10058962a0f4c30e5d711a903468a0 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCOTMwOjEyNThFRjo2NEI3NUE6ODJFRkYzOjZBRUQyQzk4IiwidmlzaXRvcl9pZCI6IjM2OTcwODc5ODA2Mzc1MDI5NiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | e1c1478a9bbfeecb20474f93b7c6c742b4aa521cebade628aff43e5fa6a68407 |
| hovercard-subject-tag | repository:27193779 |
| 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/nodejs/node/issues/64854 |
| twitter:image | https://opengraph.githubassets.com/6701ff774a019ab03961e4f5c23132793d5ffb6262dcf42c44beee10ee866659/nodejs/node |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/6701ff774a019ab03961e4f5c23132793d5ffb6262dcf42c44beee10ee866659/nodejs/node |
| og:image:alt | Node.js JavaScript runtime ✨🐢🚀✨. Contribute to nodejs/node development by creating an account on GitHub. |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | e51d0b7b5ab34b1688c05b54c3ed17b8658b2fa9bca973a9c740683ccb12cf4a |
| turbo-cache-control | no-cache |
| 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 | 59ebb7b901cc154ecc179a44f266fcf69f343b30 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width