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

Use 'defer' to simplify handling of AppNetworkStatus pending flags #3468

Merged
merged 1 commit into from
Sep 28, 2023

Conversation

milan-zededa
Copy link
Contributor

@milan-zededa milan-zededa commented Sep 26, 2023

Currently, we have to remember to set PendingAdd/PendingModify inside AppNetworkStatus to false just before the corresponding handler returns (to signal completed operation). However, there are few error branches where we forgot to clear the pending flag (e.g. when IP allocation for VIF fails). This causes zedmanager to just wait and not report the error published inside the AppNetworkStatus.
Instead of fixing this case-by-case, let's take advantage of defer to make sure that we will never forget to clear the pending flag, even if a new branch with return statement is added in the future.

@milan-zededa milan-zededa added the stable Should be backported to stable release(s) label Sep 26, 2023
@milan-zededa milan-zededa self-assigned this Sep 26, 2023
@milan-zededa milan-zededa added the bug Something isn't working label Sep 26, 2023
@codecov
Copy link

codecov bot commented Sep 26, 2023

Codecov Report

All modified lines are covered by tests ✅

Comparison is base (6e22b47) 20.29% compared to head (77460c2) 20.30%.
Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #3468   +/-   ##
=======================================
  Coverage   20.29%   20.30%           
=======================================
  Files         198      198           
  Lines       45268    45268           
=======================================
+ Hits         9188     9192    +4     
+ Misses      35396    35393    -3     
+ Partials      684      683    -1     

see 1 file with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@rouming rouming left a comment

Choose a reason for hiding this comment

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

Maybe use goto instead, e.g. "goto out"? :)

Ok, ok, I'm kidding. Don't throw tomatoes at me. ;)

Currently, we have to remember to set PendingAdd/PendingModify inside
AppNetworkStatus to false just before the corresponding handler returns.
However, there are few error branches where we forgot to clear
the pending flag. This causes zedmanager to just wait and not report
the error published inside the AppNetworkStatus.
Instead of fixing this case-by-case, let's take advantage of 'defer'
to make sure that we will never forget to clear the Pending flag,
even if a new branch with return statement is added in the future.

Signed-off-by: Milan Lenco <milan@zededa.com>
Copy link
Contributor

@eriknordmark eriknordmark left a comment

Choose a reason for hiding this comment

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

LGTM

@milan-zededa
Copy link
Contributor Author

Eden failures are not related this PR and not new. For example, we often get onboarding failure due to error:

Rebooting EVE. Reason: Reboot from agent zedbox[1441] in partition IMGA at EVE version 0.0.0-pr3468-c871bc70-kvm-amd64 at 2023-09-27T12:21:23.670313153Z: fatal: agent zedbox[1441]: couldn't initialize containerd (this should not happen): initContainerdClient: could not create containerd client. failed to dial "/run/containerd/containerd.sock": write unix @->/run/containerd/containerd.sock: use of closed network connection. Exiting.

To determine why we are getting frequent failures nowadays, we need output from collect-info. For old eden workflow this was added to eden repo here: lf-edge/eden#874
I could port it to EVE repo as well, but we are close to finalizing the new workflow and I do not want to create merge conflict with #3450
This is now blocked by PR lf-edge/eden#884 - @eriknordmark could you please merge it?

@eriknordmark eriknordmark merged commit fbacc17 into lf-edge:master Sep 28, 2023
18 of 21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working stable Should be backported to stable release(s)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants