[BUG]: nullptr dereference in create_pp_content_once (internals.h)
Open
Nobody has claimed this yet.
triage
- Dominant language
- C++
- Stars
- 18k
- Forks
- 2.3k
- Avg merge
- 5d 17h
- Merged PRs (30d)
- 10
Description
Required prerequisites
- Make sure you've read the documentation. Your issue may be addressed there.
- Search the issue tracker and Discussions to verify that this hasn't already been reported. +1 or comment there if it has.
- Consider asking first in the Gitter chat room or in a Discussion.
What version (or hash if on master) of pybind11 are you using?
3.0.4
Problem description
The crash occurs on Windows when importing my pybind11 lib after pyarrow 18.1.0 is already imported. The conditions for it to crash are weirdly specific:
- It disappears if my library is compiled in Debug
- It disappears if i upgrade pyarrow to 19.0.0
- It disappears if I upgrade to python 3.14
The nullptr dererefence happens in the functioncreate_pp_content_oncewhen lockingpp_set_mutex_even though the mutex seemed initialized (I cannot be sure however because I was looking at an optimized build).
I reproduced the crash with an empty module compiled with pybind11.
I am building with Visual Studio 2022.
Reproducible example code
#include <pybind11/pybind11.h>
PYBIND11_MODULE(foo, m){}
import pyarrow
import foo
Is this a regression? Put the last known working version here if it is.
3.0.1
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the Windows release-build reproduction using pyarrow 18.1.0, Python 3.14 or earlier, and the minimal foo module. Inspect create_pp_content_once and pp_set_mutex_ in internals.h, then compare behavior across pybind11 3.0.1 and 3.0.4. Done means importing pyarrow followed by the extension no longer dereferences nullptr.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, python
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100