[C++-sig] shared_ptr and GIL crash in boost::python (patch)

Václav Šmilauer eu at doxos.eu
Wed May 6 07:27:01 CEST 2015


Hi everybody,

I have been affected for years by the [1] bug: when shared_ptr for an 
object created in python is released in c++ in multi-threaded code, 
Python crashes -- because the shared_ptr_deleter does not lock the GIL 
before calling Python functions (as the object is destroyed).

The referenced bug also contains a 2-line patch; several people report 
that they have to hand-patch boost::python for their production code. In 
my case, I can work around the bug by locking the GIL around those few 
places where this scenario can occur (they are fortunately relatively 
few in my case), without recompiling boost.

I would like to ask someone to look at the patch if it is safe to be 
applied, and do so. It's been first identified 2 years ago. If I can do 
something on my part, or other reporters, I am willing to do whatever is 
necessary to expedite this.

Opinions?

Cheers, Václav

[1] https://svn.boost.org/trac/boost/ticket/8290


More information about the Cplusplus-sig mailing list