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

Fix caching #545

Merged
merged 11 commits into from Oct 14, 2021
Merged

Fix caching #545

merged 11 commits into from Oct 14, 2021

Conversation

JoranAngevaare
Copy link
Member

@JoranAngevaare JoranAngevaare commented Oct 7, 2021

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).

@WenzDaniel
Copy link
Collaborator

WenzDaniel commented Oct 7, 2021

I think there is something odd going on with the base you started your PR from.

@JoranAngevaare JoranAngevaare marked this pull request as draft October 7, 2021 14:58
@JoranAngevaare
Copy link
Member Author

Right, it should have been a draft there is also some other things I need to remove

@JoranAngevaare JoranAngevaare added the bug Something isn't working label Oct 7, 2021
@@ -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_')
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the fix

@JoranAngevaare
Copy link
Member Author

stupid codefactor, I didn't touch that part of the code

@JoranAngevaare JoranAngevaare marked this pull request as ready for review October 7, 2021 15:49
@WenzDaniel
Copy link
Collaborator

WenzDaniel commented Oct 11, 2021

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.

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.

Copy link
Collaborator

@WenzDaniel WenzDaniel left a 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.

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

Successfully merging this pull request may close these issues.

None yet

2 participants