René's URL Explorer Experiment


Title: ThreadsafeFunction in worker_threads cause segfault randomly · Issue #58484 · nodejs/node · GitHub

Open Graph Title: ThreadsafeFunction in worker_threads cause segfault randomly · Issue #58484 · nodejs/node

X Title: ThreadsafeFunction in worker_threads cause segfault randomly · Issue #58484 · nodejs/node

Description: Version v22.16.0 Platform Linux ubuntu-22.04 6.13.7-orbstack-00283-g9d1400e7e9c6 #104 SMP Mon Mar 17 06:15:48 UTC 2025 aarch64 aarch64 aarch64 GNU/Linux Subsystem No response What steps will reproduce the bug? Steps clone https://github....

Open Graph Description: Version v22.16.0 Platform Linux ubuntu-22.04 6.13.7-orbstack-00283-g9d1400e7e9c6 #104 SMP Mon Mar 17 06:15:48 UTC 2025 aarch64 aarch64 aarch64 GNU/Linux Subsystem No response What steps will reprod...

X Description: Version v22.16.0 Platform Linux ubuntu-22.04 6.13.7-orbstack-00283-g9d1400e7e9c6 #104 SMP Mon Mar 17 06:15:48 UTC 2025 aarch64 aarch64 aarch64 GNU/Linux Subsystem No response What steps will reprod...

Opengraph URL: https://github.com/nodejs/node/issues/58484

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"ThreadsafeFunction in worker_threads cause segfault randomly","articleBody":"### Version\n\nv22.16.0\n\n### Platform\n\n```text\nLinux ubuntu-22.04 6.13.7-orbstack-00283-g9d1400e7e9c6 #104 SMP Mon Mar 17 06:15:48 UTC 2025 aarch64 aarch64 aarch64 GNU/Linux\n```\n\n### Subsystem\n\n_No response_\n\n### What steps will reproduce the bug?\n\n#### Steps\n\n- clone https://github.com/napi-rs/napi-rs\n- checkout `05-25-test_stress_test_on_aarch64_linux_gnu_platform` branch\n- Install latest Node.js and Rust\n- yarn install\n- yarn build:test\n- yarn workspace @examples/napi test __tests__/worker-thread.spec.ts --match '*worker_threads'\n\n#### Summary\n\nBecause NAPI-RS encapsulates too many things, I'll describe as briefly as possible the scenario where I encountered a segfault.\n\nHere is a simple `async` function in Rust:\n\n```rust\n#[napi]\npub fn buffer_pass_through(buffer: Buffer) -\u003e Buffer {\n  buffer\n}\n```\n\nThe NAPI-RS would do these under the hood:\n\n- call `napi_create_promise` and get `defer` and `promise`, `promise` would return directly\n- call `napi_create_threadsafe_function` and pass the `defer` as the ThreadsafeFunction `context`\n- use `tokio::spawn` to run the async function, call the `ThreadsafeFunction` when async function has a value\n- call `napi_release_threadsafe_function` after the `ThreadsafeFunction` is called\n\nIf this function is not called in worker_threads, there's no problem. I tried writing a loop that calls it hundreds of thousands of times, and didn't find any issues.\n\nHowever, when this function is called in worker_threads, segfaults occasionally occur, which has been observed both in CI and in feedback from my users.\n\n\n\nBacktrace from lldb:\n\n```\n* thread #26, name = 'tokio-runtime-w', stop reason = signal SIGABRT\n  * frame #0: 0x0000fffff7b07608 libc.so.6`__pthread_kill_implementation(threadid=281472292351904, signo=6, no_tid=\u003cunavailable\u003e) at pthread_kill.c:44:76\n    frame #1: 0x0000fffff7abcb3c libc.so.6`__GI_raise(sig=6) at raise.c:26:13\n    frame #2: 0x0000fffff7aa7e00 libc.so.6`__GI_abort at abort.c:79:7\n    frame #3: 0x0000aaaaad7dfb38 node`uv_mutex_lock(mutex=0x0000fffdf816b038) at thread.c:345:5\n    frame #4: 0x0000aaaaabeab7c4 node`node::LibuvMutexTraits::mutex_lock(mutex=0x0000fffdf816b038) at node_mutex.h:183:18\n    frame #5: 0x0000aaaaabead48c node`node::MutexBase\u003cnode::LibuvMutexTraits\u003e::ScopedLock::ScopedLock(this=0x0000ffff5fffc370, mutex=0x0000fffdf816b038) at node_mutex.h:285:21\n    frame #6: 0x0000aaaaac03f4d4 node`v8impl::(anonymous namespace)::ThreadSafeFunction::Release(this=0x0000fffdf816b010, mode=napi_tsfn_release) const at node_api.cc:276:45\n    frame #7: 0x0000aaaaac043160 node`napi_release_threadsafe_function(func=0x0000fffdf816b010, mode=napi_tsfn_release) at node_api.cc:1411:70\n    frame #8: 0x0000ffffddc45c78 example.linux-arm64-gnu.node`napi::js_values::deferred::JsDeferred$LT$Data$C$Resolver$GT$::call_tsfn::h488d0dbaa4a26cb5(self=JsDeferred\u003cnapi::js_values::unknown::Unknown, napi::tokio_runtime::execute_tokio_future::{async_block#0}::{closure_env#0}\u003cnapi::bindgen_runtime::js_values::arraybuffer::Uint8Array, napi_examples::typed_array::_napi_internal_register_array_buffer_pass_through::{closure#0}::{async_block_env#1}, napi_examples::typed_array::_napi_internal_register_array_buffer_pass_through::{closure#0}::{closure_env#2}, napi::error::Error\u003cnapi::status::Status\u003e\u003e\u003e @ 0x0000ffff5fffc490, result=\u003cunavailable\u003e) at deferred.rs:183:7\n    frame #9: 0x0000ffffddc44d40 example.linux-arm64-gnu.node`napi::js_values::deferred::JsDeferred$LT$Data$C$Resolver$GT$::resolve::h3d2884560cd31212(self=JsDeferred\u003cnapi::js_values::unknown::Unknown, napi::tokio_runtime::execute_tokio_future::{async_block#0}::{closure_env#0}\u003cnapi::bindgen_runtime::js_values::arraybuffer::Uint8Array, napi_examples::typed_array::_napi_internal_register_array_buffer_pass_through::{closure#0}::{async_block_env#1}, napi_examples::typed_array::_napi_internal_register_array_buffer_pass_through::{closure#0}::{closure_env#2}, napi::error::Error\u003cnapi::status::Status\u003e\u003e\u003e @ 0x0000ffff5fffc520, resolver=\u003cunavailable\u003e) at deferred.rs:154:5\n    frame #10: 0x0000ffffddb57d00 example.linux-arm64-gnu.node`napi::tokio_runtime::execute_tokio_future::_$u7b$$u7b$closure$u7d$$u7d$::ha7f1ee1bf2582723((null)=0x0000ffff5fffc9b0) at tokio_runtime.rs:233:16\n    frame #11: 0x0000ffffdd9158fc example.linux-arm64-gnu.node`tokio::runtime::task::core::Core$LT$T$C$S$GT$::poll::_$u7b$$u7b$closure$u7d$$u7d$::hdd5c00f1ec17be65(ptr=0x0000fffdf815abb0) at core.rs:331:17\n    frame #12: 0x0000ffffdd8fed1c example.linux-arm64-gnu.node`tokio::runtime::task::core::Core$LT$T$C$S$GT$::poll::h2a9ed49810ab1294 [inlined] tokio::loom::std::unsafe_cell::UnsafeCell$LT$T$GT$::with_mut::h21552376c10d6f31(self=0x0000fffdf815abb0, f={closure_env#0}\u003cnapi::tokio_runtime::execute_tokio_future::{async_block_env#0}\u003cnapi::bindgen_runtime::js_values::arraybuffer::Uint8Array, napi_examples::typed_array::_napi_internal_register_array_buffer_pass_through::{closure#0}::{async_block_env#1}, napi_examples::typed_array::_napi_internal_register_array_buffer_pass_through::{closure#0}::{closure_env#2}, napi::error::Error\u003cnapi::status::Status\u003e\u003e, alloc::sync::Arc\u003ctokio::runtime::scheduler::multi_thread::handle::Handle, alloc::alloc::Global\u003e\u003e @ 0x0000ffff5fffc968) at unsafe_cell.rs:16:9\n    frame #13: 0x0000ffffdd8fed00 example.linux-arm64-gnu.node`tokio::runtime::task::core::Core$LT$T$C$S$GT$::poll::h2a9ed49810ab1294(self=0x0000fffdf815aba0, cx=\u003cunavailable\u003e) at core.rs:320:13\n```\n\n### How often does it reproduce? Is there a required condition?\n\nRepeat 3-5 times and it will appear randomly.\n\n### What is the expected behavior? Why is that the expected behavior?\n\nNo segfault\n\n### What do you see instead?\n\nSegfault\n\n### Additional information\n\nMaybe related: https://github.com/nodejs/node/issues/55706","author":{"url":"https://github.com/Brooooooklyn","@type":"Person","name":"Brooooooklyn"},"datePublished":"2025-05-27T15:53:41.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":5},"url":"https://github.com/58484/node/issues/58484"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:e45e7634-0b2d-3f84-5ad8-f59f32aff992
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-id9B6A:6D260:858D9:B5057:6A4D2E36
html-safe-nonce963a8497755285b98a1027c9c6b7b698a86ab44fe1d603741082c297aea58669
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5QjZBOjZEMjYwOjg1OEQ5OkI1MDU3OjZBNEQyRTM2IiwidmlzaXRvcl9pZCI6IjY2NzUyODE4ODc0MDM3ODE2ODYiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmac7939dc0b6b4057f3f58a882a9e4896a080f850566d4bbcb148ed8538dee01780
hovercard-subject-tagissue:3094425419
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/nodejs/node/58484/issue_layout
twitter:imagehttps://opengraph.githubassets.com/ad41613d3afe7b0d925e5842b942da7c45e8c64683a5f9466e169cfe52fbe790/nodejs/node/issues/58484
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/ad41613d3afe7b0d925e5842b942da7c45e8c64683a5f9466e169cfe52fbe790/nodejs/node/issues/58484
og:image:altVersion v22.16.0 Platform Linux ubuntu-22.04 6.13.7-orbstack-00283-g9d1400e7e9c6 #104 SMP Mon Mar 17 06:15:48 UTC 2025 aarch64 aarch64 aarch64 GNU/Linux Subsystem No response What steps will reprod...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameBrooooooklyn
hostnamegithub.com
expected-hostnamegithub.com
None92571a8944142227b7e19cd10918b1ddd06e5066c1ad5bc7e4769cf6140a87e6
turbo-cache-controlno-preview
go-importgithub.com/nodejs/node git https://github.com/nodejs/node.git
octolytics-dimension-user_id9950313
octolytics-dimension-user_loginnodejs
octolytics-dimension-repository_id27193779
octolytics-dimension-repository_nwonodejs/node
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id27193779
octolytics-dimension-repository_network_root_nwonodejs/node
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release93f17a978ee60bc4668e1d7b90e6bd2d622261fd
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/nodejs/node/issues/58484#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fnodejs%2Fnode%2Fissues%2F58484
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub Copilot appDirect agents from issue to mergehttps://github.com/features/ai/github-app
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
View all resourceshttps://github.com/resources
GitHub SponsorsFund open source developershttps://github.com/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/accelerator
GitHub Starshttps://stars.github.com
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fnodejs%2Fnode%2Fissues%2F58484
Sign up https://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=nodejs%2Fnode
Reloadhttps://github.com/nodejs/node/issues/58484
Reloadhttps://github.com/nodejs/node/issues/58484
Reloadhttps://github.com/nodejs/node/issues/58484
Please reload this pagehttps://github.com/nodejs/node/issues/58484
nodejs https://github.com/nodejs
nodehttps://github.com/nodejs/node
Please reload this pagehttps://github.com/nodejs/node/issues/58484
Notifications https://github.com/login?return_to=%2Fnodejs%2Fnode
Fork 36k https://github.com/login?return_to=%2Fnodejs%2Fnode
Star 118k https://github.com/login?return_to=%2Fnodejs%2Fnode
Code https://github.com/nodejs/node
Issues 1.4k https://github.com/nodejs/node/issues
Pull requests 956 https://github.com/nodejs/node/pulls
Actions https://github.com/nodejs/node/actions
Projects https://github.com/nodejs/node/projects
Security and quality 0 https://github.com/nodejs/node/security
Insights https://github.com/nodejs/node/pulse
Code https://github.com/nodejs/node
Issues https://github.com/nodejs/node/issues
Pull requests https://github.com/nodejs/node/pulls
Actions https://github.com/nodejs/node/actions
Projects https://github.com/nodejs/node/projects
Security and quality https://github.com/nodejs/node/security
Insights https://github.com/nodejs/node/pulse
ThreadsafeFunction in worker_threads cause segfault randomlyhttps://github.com/nodejs/node/issues/58484#top
https://github.com/KevinEady
node-apiIssues and PRs related to the Node-API.https://github.com/nodejs/node/issues?q=state%3Aopen%20label%3A%22node-api%22
https://github.com/Brooooooklyn
Brooooooklynhttps://github.com/Brooooooklyn
on May 27, 2025https://github.com/nodejs/node/issues/58484#issue-3094425419
https://github.com/napi-rs/napi-rshttps://github.com/napi-rs/napi-rs
#55706https://github.com/nodejs/node/issues/55706
KevinEadyhttps://github.com/KevinEady
node-apiIssues and PRs related to the Node-API.https://github.com/nodejs/node/issues?q=state%3Aopen%20label%3A%22node-api%22
Node-API Team Projecthttps://github.com/orgs/nodejs/projects/11
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.