Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Race condition on class copying when a thread reads a Threaded object provided from another thread #73

Open
dktapps opened this issue Nov 28, 2021 · 0 comments

Comments

@dktapps
Copy link
Member

dktapps commented Nov 28, 2021

When PTHREADS_INHERIT_NONE is used (or when a Threaded object is created using a class loaded after thread start), the class has to be copied on the fly by other threads when that Threaded object is read into said threads.

This is problematic because it may lead to races between the two threads, resulting in borked copies and/or segfaults.

This would have to be addressed by having the class copied to permanent storage when assigned to a Threaded member.

dktapps added a commit that referenced this issue Apr 24, 2023
this is currently unfinished, and it will attempt to fire the autoloader for every class when INHERIT_ALL is used, which is not intended.

the aim is to avoid class copying wherever possible, since copying classes is a source of stability issues.

this change also allows sidestepping #73 for named classes.
dktapps added a commit that referenced this issue Feb 5, 2024
we know already that copying classes on the fly for object sharing is racy (see #73), but this reduces the number of opportunities for a harmful race condition.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant