Title: [BUG]: Legacy driver callback bookkeeping races under free-threaded Python, causing native abort · Issue #3282 · NVIDIA/cuda-python · GitHub
Open Graph Title: [BUG]: Legacy driver callback bookkeeping races under free-threaded Python, causing native abort · Issue #3282 · NVIDIA/cuda-python
X Title: [BUG]: Legacy driver callback bookkeeping races under free-threaded Python, causing native abort · Issue #3282 · NVIDIA/cuda-python
Description: Is this a duplicate? I confirmed there appear to be no duplicate issues for this bug and that I agree to the Code of Conduct Type of Bug Runtime Error Component cuda.bindings Describe the bug A nightly CI job aborted with exit code 134 w...
Open Graph Description: Is this a duplicate? I confirmed there appear to be no duplicate issues for this bug and that I agree to the Code of Conduct Type of Bug Runtime Error Component cuda.bindings Describe the bug A nig...
X Description: Is this a duplicate? I confirmed there appear to be no duplicate issues for this bug and that I agree to the Code of Conduct Type of Bug Runtime Error Component cuda.bindings Describe the bug A nig...
Opengraph URL: https://github.com/NVIDIA/cuda-python/issues/3282
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[BUG]: Legacy driver callback bookkeeping races under free-threaded Python, causing native abort","articleBody":"### Is this a duplicate?\n\n- [x] I confirmed there appear to be no [duplicate issues](https://github.com/NVIDIA/cuda-python/issues) for this bug and that I agree to the [Code of Conduct](CODE_OF_CONDUCT.md)\n\n### Type of Bug\n\nRuntime Error\n\n### Component\n\ncuda.bindings\n\n### Describe the bug\n\nA nightly CI job aborted with exit code 134 while running tests/legacy_api/test_legacy_cuda.py::test_culogs_functions with four parallel threads.\n[Failing job](https://github.com/NVIDIA/cuda-python/actions/runs/40791244909/job/123179307143)\n\nEnvironment:\n- Commit: d649075a50b97245b63381052481f2eaadd57f1c\n- Linux aarch64, Python 3.15.2 free-threaded\n- CUDA Toolkit 13.4.2, NVIDIA driver 595.99.02, L4 GPU\n- pytest-run-parallel==0.10.0, --parallel-threads=4, --count=5\nThe Python stack points to cuLogsUnregisterCallback(callback_handle). Disassembly of the exact wheel places the native abort in map-node deletion during std::map::erase().\nThe legacy bindings store callback allocations in the shared m_global._allocated C++ map. \n\ncuLogsRegisterCallback inserts entries, while cuLogsUnregisterCallback frees callback data and erases entries without synchronization. Concurrent access under free-threaded Python is the likely cause of memory corruption. Async-notification callback APIs also access this map.\n\nExpected behavior: concurrent registration and unregistration of independent callbacks completes safely.\n\nSuggested fix: synchronize callback bookkeeping at the binding-generation source, covering all APIs that share the map, and add concurrent regression coverage. Serializing the affected test could provide an interim CI mitigation.\n\nThe full CUDA test has not been reproduced locally. The matching ARM Python 3.14t job passed on the same driver version, suggesting an intermittent race.\n\nSome history: \n\nRecent test changes likely exposed an older bug. I found no recent change introducing the unsafe map operations.\n- May 2025: The cuLogs* wrappers already used the shared map without synchronization. ([#597](https://github.com/NVIDIA/cuda-python/pull/597))\n- September 2, 2026: CI enabled four parallel test threads for free-threaded Python. ([#2194](https://github.com/NVIDIA/cuda-python/pull/2194))\n- October 5: test_culogs_functions was added, exercising registration and cleanup. ([#2978](https://github.com/NVIDIA/cuda-python/pull/2978))\n- October 15: Context pooling increased actual overlap between worker threads. The commit explicitly notes that context creation previously kept them apart. This is the strongest candidate for making the existing race easier to trigger. ([#3122](https://github.com/NVIDIA/cuda-python/pull/3122))\n\n\n### How to Reproduce\n\nNot reproducible. \n\n### Expected behavior\n\nExpected behavior: concurrent registration and unregistration of independent callbacks completes safely.\n\n\n### Operating System\n\n_No response_\n\n### nvidia-smi output\n\n_No response_","author":{"url":"https://github.com/jpascucci-nv","@type":"Person","name":"jpascucci-nv"},"datePublished":"2026-10-29T15:15:21Z","url":"https://github.com/NVIDIA/cuda-python/issues/3282"}
| 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 | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:594f723b-9e6d-f1af-6feb-eee8d8512853 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C54E:D6380:1585EF:1DDE73:6AF8374A |
| html-safe-nonce | 07a3584f6777f32c4bab447c1376ef38ee04b1f676534a1d0affd9799099bd40 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDNTRFOkQ2MzgwOjE1ODVFRjoxRERFNzM6NkFGODM3NEEiLCJ2aXNpdG9yX2lkIjoiODE3Mzc0Njk2NzExNzU3NjAxMCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | a1423c5d15fa1cd3507a221677b3d51606473bda99470ea85f2826d13b0bd89d |
| hovercard-subject-tag | issue:6102722384 |
| 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/NVIDIA/cuda-python/3282/issue_layout |
| twitter:image | https://opengraph.githubassets.com/d6a766158cf20cae50f814b1c6fe1da2f2eacf2afa7e6736b76177ffec173dbd/NVIDIA/cuda-python/issues/3282 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/d6a766158cf20cae50f814b1c6fe1da2f2eacf2afa7e6736b76177ffec173dbd/NVIDIA/cuda-python/issues/3282 |
| og:image:alt | Is this a duplicate? I confirmed there appear to be no duplicate issues for this bug and that I agree to the Code of Conduct Type of Bug Runtime Error Component cuda.bindings Describe the bug A nig... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | jpascucci-nv |
| hostname | github.com |
| expected-hostname | github.com |
| None | 5713ecd83001b2f55c3509fb7a292bf7d66d0f167c7ae87a9f7eaec5a52bf8db |
| turbo-cache-control | no-preview |
| go-import | github.com/NVIDIA/cuda-python git https://github.com/NVIDIA/cuda-python.git |
| octolytics-dimension-user_id | 1728152 |
| octolytics-dimension-user_login | NVIDIA |
| octolytics-dimension-repository_id | 381173759 |
| octolytics-dimension-repository_nwo | NVIDIA/cuda-python |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 381173759 |
| octolytics-dimension-repository_network_root_nwo | NVIDIA/cuda-python |
| 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 | 653be32ff5c755082a4db662491bfbbcfc9112c1 |
| ui-target | canary-2 |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width