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

Work around uuid file corruption in balenaEngine health check #3409

Merged
merged 1 commit into from
Jun 6, 2024

Conversation

lmbarros
Copy link
Contributor

@lmbarros lmbarros commented Apr 17, 2024

We have detected one more way in which the uuid file used by containerd can get corrupted. This time, the file is not empty, but doesn't contain a valid UUID either.

This commit thus extends the existing workaround to also handle this case.

See balena-os/balena-engine#322

Testing

I tested this manually only. I built balenaOS for raspberrypi3-64 using my branch of meta-balena and flashed it to a device. Then I tried to manually change the contents of the uuid file and run the health check to see the results:

  • When changing it to one of the formats accepted by containerd, the healthcheck passed and the uuid file remained unchanged.
  • When changing it to an invalid format (including making it an empty file), or removing it altogether, the healthcheck passed and and new, valid uuid file was created.

In other words, no form of bad uuid should not cause the Engine healthcheck to fail after this change.

Regarding automated tests: I believe it should be possible to add some automated test cases for that -- basically automate the kind of manual testing I described above. I am not so sure this would add significant value, though. (FWIW, we don't have automated tests for the current version of this workaround)


Contributor checklist

Reviewer Guidelines

  • When submitting a review, please pick:
    • 'Approve' if this change would be acceptable in the codebase (even if there are minor or cosmetic tweaks that could be improved).
    • 'Request Changes' if this change would not be acceptable in our codebase (e.g. bugs, changes that will make development harder in future, security/performance issues, etc).
    • 'Comment' if you don't feel you have enough information to decide either way (e.g. if you have major questions, or you don't understand the context of the change sufficiently to fully review yourself, but want to make a comment)

# Check for all the possible formats, starting with the most common one, to
# benefit from the short-circuited evaluation. The contents of the uuid file
# must match these formats exactly, so we anchor the regexes both at the
# beginning (^) and the end ($).
Copy link
Collaborator

Choose a reason for hiding this comment

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

Love the detailed comments!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I believe time travel is impossible, because otherwise I'd expect someone to have come back to thank me for those 😝

@alexgg alexgg force-pushed the lmb/corrupted-uuid-file branch from eab468d to 4d17f0b Compare May 15, 2024 08:35
@flowzone-app flowzone-app bot enabled auto-merge May 15, 2024 08:39
@lmbarros
Copy link
Contributor Author

@resin-jenkins retest this please

@lmbarros lmbarros force-pushed the lmb/corrupted-uuid-file branch 2 times, most recently from a09d9e0 to 1281755 Compare May 27, 2024 17:53
@lmbarros
Copy link
Contributor Author

@resin-jenkins retest this please

@alexgg alexgg force-pushed the lmb/corrupted-uuid-file branch from 1281755 to 9dbb95c Compare June 2, 2024 15:12
@lmbarros lmbarros force-pushed the lmb/corrupted-uuid-file branch from 9dbb95c to 2986278 Compare June 4, 2024 20:50
We have detected one more way in which the uuid file used by containerd
can get corrupted. This time, the file is not empty, but doesn't contain
a valid UUID either.

This commit thus extends the existing workaround to also handle this
case.

See balena-os/balena-engine#322

Signed-off-by: Leandro Motta Barros <[email protected]>
Change-type: patch
@lmbarros lmbarros force-pushed the lmb/corrupted-uuid-file branch from 2986278 to e3696fc Compare June 5, 2024 12:11
@rhampt rhampt requested a review from klutchell June 5, 2024 17:29
@klutchell
Copy link
Collaborator

@resin-jenkins retest this please

@flowzone-app flowzone-app bot merged commit 3570c9d into master Jun 6, 2024
52 checks passed
@flowzone-app flowzone-app bot deleted the lmb/corrupted-uuid-file branch June 6, 2024 22:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants