pybind / pybind/pybind11

[BUG]: nullptr dereference in create_pp_content_once (internals.h)

Open
#6,046 0 comments 0 reactions 0 assignees View on GitHub

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
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 function create_pp_content_once when locking pp_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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.