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

Possible threading bug with dynamic initializer #415

Open
nfriendlybrinc opened this issue Jan 26, 2024 · 0 comments
Open

Possible threading bug with dynamic initializer #415

nfriendlybrinc opened this issue Jan 26, 2024 · 0 comments
Labels
debugging Might be a bug, looking into the issue

Comments

@nfriendlybrinc
Copy link

I think there is a thread safety issue during initialization when the use_multi_threading_subs parameter is set to true. The dynamic initializer twice calls _db->get_internal_data() and then iterates over the contents of the data (lines 51 and 87). Best I can tell, this becomes an issue if another thread causes the data to get modified. While the feature database methods have a lock to prevent simultaneous modification to the database itself, there's nothing to prevent simultaneous modification of the features themselves. You can get unprotected access to the features via the following database methods get_internal_data(), features_not_containing_newer(), features_containing_older(), and features_containing().

As a quick check, I modified those methods to return const pointers to the features. This showed there are multiple places in the code base that modify features via these methods.

for (auto const &feat : _db->get_internal_data()) {

@goldbattle goldbattle added the debugging Might be a bug, looking into the issue label Feb 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
debugging Might be a bug, looking into the issue
Projects
None yet
Development

No branches or pull requests

2 participants