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 bug when reusing the same cell in multiple hives #27873

Merged
merged 1 commit into from
Sep 19, 2023

Conversation

giorio94
Copy link
Member

@giorio94 giorio94 commented Sep 1, 2023

Currently, the "Invoke" cell internally stores a reference to the container when Apply() gets called. Yet, this causes issues if the same cell is registered as part of multiple hives (e.g., constructing multiple subcommands), as that reference gets overwritten by new hive.New() executions.

Let's remove this explicit reference, capturing instead the container parameter through an anonymous function. Additionally, let's craft a unit test to prevent regressions.

Fix bug when reusing the same cell in multiple hives

@giorio94 giorio94 added kind/bug This is a bug in the Cilium logic. release-note/misc This PR makes changes that have no direct user impact. labels Sep 1, 2023
@giorio94 giorio94 requested a review from a team as a code owner September 1, 2023 08:41
@giorio94 giorio94 requested a review from ti-mo September 1, 2023 08:41
@giorio94
Copy link
Member Author

giorio94 commented Sep 1, 2023

/test

@giorio94
Copy link
Member Author

giorio94 commented Sep 1, 2023

/test

Copy link
Contributor

@joamaki joamaki left a comment

Choose a reason for hiding this comment

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

Oopsie. Thanks for the fix, LGTM!

@joamaki joamaki added the needs-backport/1.14 This PR / issue needs backporting to the v1.14 branch label Sep 11, 2023
@joamaki
Copy link
Contributor

joamaki commented Sep 11, 2023

Even though there was nothing shipped in v1.14 that was affected by this bug, lets backport this before we backport code that could be affected.

Currently, the "Invoke" cell internally stores a reference to the
container when Apply() gets called. Yet, this causes issues if the
same cell is registered as part of multiple hives (e.g., constructing
multiple subcommands), as that reference gets overwritten by new
hive.New() executions.

Let's remove this explicit reference, capturing instead the container
parameter through an anonymous function. Additionally, let's craft a
unit test to prevent regressions.

Signed-off-by: Marco Iorio <marco.iorio@isovalent.com>
@giorio94 giorio94 force-pushed the pr/giorio94/main/hive-fix-reuse-same-cell branch from b06793f to d8e094a Compare September 18, 2023 14:49
@giorio94
Copy link
Member Author

Rebased onto main

@giorio94
Copy link
Member Author

/test

@ti-mo ti-mo merged commit 6f1e496 into main Sep 19, 2023
204 of 206 checks passed
@ti-mo ti-mo deleted the pr/giorio94/main/hive-fix-reuse-same-cell branch September 19, 2023 07:52
@giorio94 giorio94 mentioned this pull request Sep 26, 2023
22 tasks
@giorio94 giorio94 added backport-pending/1.14 The backport for Cilium 1.14.x for this PR is in progress. and removed needs-backport/1.14 This PR / issue needs backporting to the v1.14 branch labels Sep 26, 2023
@aanm aanm added backport-done/1.14 The backport for Cilium 1.14.x for this PR is done. and removed backport-pending/1.14 The backport for Cilium 1.14.x for this PR is in progress. labels Sep 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-done/1.14 The backport for Cilium 1.14.x for this PR is done. kind/bug This is a bug in the Cilium logic. release-note/misc This PR makes changes that have no direct user impact.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants