You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I get multiple kinds of errors when accessing Foo.Bar from multiple threads, from segmentation faults to "pybind11_object_dealloc(): Tried to deallocate unregistered instance!" exceptions.
Further investigation suggested that it might come from Foo.Bar being freed too many times. I'm unsure if it's a pybind11 or CPython issue so I'm posting it here.
Reproducible example code
importthreadingfromfooimportFoodefcreate_foo():
for_inrange(1000):
Foo.Bar# keeping a reference to Foo.Bar prevents the issue from happening# bar = Foo.Barnb_threads=10threads= [threading.Thread(target=create_foo) for_inrange(nb_threads)]
forthreadinthreads:
thread.start()
forthreadinthreads:
thread.join()
Is this a regression? Put the last known working version here if it is.
Not a regression
The text was updated successfully, but these errors were encountered:
Required prerequisites
What version (or hash if on master) of pybind11 are you using?
v2.13.6
Problem description
With free-threaded Python, I get data races when using static class variables defined like this:
I get multiple kinds of errors when accessing
Foo.Bar
from multiple threads, from segmentation faults to "pybind11_object_dealloc(): Tried to deallocate unregistered instance!
" exceptions.Further investigation suggested that it might come from
Foo.Bar
being freed too many times. I'm unsure if it's a pybind11 or CPython issue so I'm posting it here.Reproducible example code
Is this a regression? Put the last known working version here if it is.
Not a regression
The text was updated successfully, but these errors were encountered: