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 custom component registry access #6811

Merged
merged 3 commits into from
Apr 2, 2024

Conversation

wildum
Copy link
Contributor

@wildum wildum commented Apr 2, 2024

PR Description

There is a small window where the loader is reloading (a new config is being applied) while a custom component is concurrently being re-evaluated.

To get its config, the custom component must check the custom component registry during its evaluation. This registry is re-created every time a config is applied. This means that there is a possibility that the custom component being re-evaluated is looking at a registry that is not fully initialized and might not have yet loaded the config needed. This results in a panic.

The provided fix locks the mutex before the re-evaluation to prevent both evaluations from running concurrently. In other words, the re-evaluation is paused when a new config is applied.

I added a test that triggers the bug 80% of the time on my computer. With the fix it always passes.
I also ran all import tests 50 times to check for regressions.

Which issue(s) this PR fixes

Fixes #6795

PR Checklist

  • CHANGELOG.md updated

Copy link
Contributor

@thampiotr thampiotr left a comment

Choose a reason for hiding this comment

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

LGTM!

@wildum wildum merged commit 1570f97 into main Apr 2, 2024
10 checks passed
@wildum wildum deleted the fix-custom-component-registry-access branch April 2, 2024 15:06
@github-actions github-actions bot added the frozen-due-to-age Locked due to a period of inactivity. Please open new issues or PRs if more discussion is needed. label May 3, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 3, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
frozen-due-to-age Locked due to a period of inactivity. Please open new issues or PRs if more discussion is needed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

flaky panic on CustomComponentRegistry.getDeclare
2 participants