[BUG]: Pybind11 crashes on cleanup in GCC 7.4 and 7.5
Nobody has claimed this yet.
- 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.
Problem description
Pybind consistently fails to clean up after itself if I have imported Pytorch.
When shutting down the interpreter, whether manually or via the scoped interpreter leaving scope, Pybind tries to free memory that has already been freed and crashes.
I'm using the latest stable version of pybind and GCC 7.5. The problem does not manifest in GCC 4.8.5.
More information in the example code project
Reproducible example code
https://github.com/Sleemanmunk/pybind_crash
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 linked reproducible example project and reproduce cleanup during interpreter shutdown after importing PyTorch, both manually and through the scoped interpreter. Compare behavior on GCC 7.4/7.5 and GCC 4.8.5, then trace the cleanup path; done means the example no longer crashes while shutting down.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, python, pytorch
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100