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

HashStore Class Variables Causing Conflicts Upon Import #119

Closed
doulikecookiedough opened this issue Jul 2, 2024 · 1 comment
Closed
Assignees
Labels
bug Something isn't working

Comments

@doulikecookiedough
Copy link
Contributor

doulikecookiedough commented Jul 2, 2024

In FileHashStore, thread and multiprocessing variables (threading.Lock(), multiprocessing.Lock(), etc.) are declared outside of the __init__ process. This can create conflicts upon importing hashstore as a library, and not part of a main method in a python program (which can guard against top-level code being executed in new processes unintentionally).

This is especially true with the multiprocessing module due to the nature of how processes are spawned and initialized. Each new spawn process will re-import the module (recursive import).

These should not be declared as class variables, but determined upon instantiation instead so that it does not interfere with the initial set-up phase of the Python interpreter and its environment (ex. move them to the __init__ method).

@doulikecookiedough doulikecookiedough added the bug Something isn't working label Jul 2, 2024
@doulikecookiedough doulikecookiedough self-assigned this Jul 2, 2024
@doulikecookiedough
Copy link
Contributor Author

This has been resolved via Bug-119: hashstore Library Import Conflict

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant