Back Home

GitHub Repo

PyTorch Community Reports macOS Package Compatibility Issue; Python 3.15 Background Threads May Crash

A PyTorch community report on October 24 says the 2.14.1 macOS arm64 package for Python 3.15 may crash the process when a background thread releases a tensor. The report includes a minimal reproduction and binary analysis, but maintainers have yet to confirm the root cause or an official fix.

Pytorch Deepdream (https://github.com/gordicaleksa/pytorch-deepdream) by gordicaleksa (https://github.com/gordicaleksa/pytorch-deepdream/commits?author=gordicaleksa) · MIT · Image source
zh-Hant

On October 24, the PyTorch community received a binary compatibility report: with macOS arm64, Python 3.15.0, and torch 2.14.1, a segmentation fault may occur when a background thread reacquires the Python Global Interpreter Lock (GIL). The reporter said the issue first appeared in a video-decoding worker thread, then reduced it to a reproduction that depends only on PyTorch and a small C++ extension. Issue report

The trigger involves object lifetimes across languages: C++ first retains a tensor, Python deletes the corresponding object, and then a background thread clears the final C++ reference while the GIL is released. The reported stack trace points to GIL management in pybind11 and the tensor reference cleanup path. The official pybind11 documentation explains that C++ must hold the GIL when accessing Python state, and that destructors and reference counting are also error-prone areas; tensor cleanup may therefore need to reacquire the lock as well. GIL documentation

The reporter’s disassembly analysis points to the build headers: the tested package accesses a thread-state field at a location that differs from its layout in the Python 3.15 release, leading the reporter to suspect that the package was built with earlier prerelease headers. This remains the submitter’s assessment of the root cause and should not be treated as an official conclusion. In the reporter’s comparison tests, the same PyTorch version worked with Python 3.14, and the tested nightly worked with 3.15; these results cover only the listed environments. Analysis and comparisons

For teams maintaining local multimodal pipelines or C++ extensions, this report highlights the need to include background threads and object cleanup in upgrade testing. Successfully importing a package alone is not enough to confirm compatibility. Python’s official documentation confirms that 3.15 was released on October 9, so recent adopters can include this reproduction case in their environment checks. Python release notes

As of this review, the issue remains open, with no maintainer confirmation or fix linked. Follow-up should track whether the project rebuilds the package, identifies affected platforms, and whether a stable release passes the same tests; a single successful nightly test should not be treated as a guarantee of a complete fix.

Sources

  1. PyTorch issue #201944:macOS arm64 cp315 wheel 背景執行緒崩潰回報
  2. pybind11:Global Interpreter Lock
  3. What’s new in Python 3.15