boostorg / python

Boost.org python module
http://boostorg.github.io/python
Boost Software License 1.0
468 stars 201 forks source link

Crash in plumbum module when importing .so linked with gold #370

Open mmatrosov opened 3 years ago

mmatrosov commented 3 years ago

I am not sure it is boost.python's fault, since there are a lot of variables in the equation, but please take a look.

I prepared the repro case and gathered some info in this repo: https://github.com/mmatrosov/plumbum-crash-repro

In short, if you import an extension library in c++ which uses boost.python, compiles with clang and links with gold, there is a crash in this line https://github.com/tomerfiliba/plumbum/blob/master/plumbum/commands/processes.py#L286 during program shutdown. It does not happen if the extension is not loaded, and I've never experienced this crash even though plumbum is widely used in our scripts.

stefanseefeld commented 3 years ago

For avoidance of doubt: the title mentions "when importing", but the actual text talks about "shutdown". Can you please clarify ? An actual stack trace would be useful. And please try to reduce your test case to enable others to reproduce it without having to download and build your own project first.

mmatrosov commented 3 years ago

The crash happens during the shutdown, but only when there is import of an .so. The stack traces are available in the linked repo. I reduced the repro as much as I could, it is hard not to build anything when you have bugs involving both c++ and python. And I hope anyone willing to reproduce would be able to build the repro with a single call to build.py. The only option I am aware of on how to simplify the repro even more is to provide a docker image. Please let me know if you think this is necessary.