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
Fix caching #545
Fix caching #545
Conversation
I think there is something odd going on with the base you started your PR from. |
Right, it should have been a draft there is also some other things I need to remove |
@@ -433,7 +433,9 @@ def _context_hash(self): | |||
# Also take into account the versions of the plugins registered | |||
base_hash_on_config.update( | |||
{data_type: (plugin.__version__, plugin.compressor, plugin.input_timeout) | |||
for data_type, plugin in self._plugin_class_registry.items()}) | |||
for data_type, plugin in self._plugin_class_registry.items() | |||
if not data_type.startswith('_temp_') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the fix
stupid codefactor, I didn't touch that part of the code |
Sorry, I do not fully get this part. I tried to recall how it works based on #483 and #485. Do you really mean context hash? I thought several plugins are stored under the same context hash, but different keys for the individual plugins. Why are we deleting the context hash when removing a _temp- plugin? Okay nvm, was just too late yesterday. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks fine, thanks a lot.
What is the problem / what does the code in this PR do
Dominick noticed this error first, where a temporary plugin caused the context_hash to change during the computation of multiple runs.
The issue is that we add some temp. plugin here and then delete it here, in between there is get_components which builds the cache (if applicable). Since Dominick was doing this with 4 workers, they each got their own context hash as they were registering and de-registering the temporary plugins in parallel. Because of that, there was a chance that the context hash was removed from the cache by the time it was requested in another thread.
There would also be another way of dealing with this, and that is allowing multiple context hashes to be cached, however, this would be slow and also not needed, for the temporary plugins aren't re-used anyway (each thread generates another random hash).