Repository navigation
file driver: replace device JSON files atomically - #162
Merged
Merged
Conversation
A device's attest request can fail with "getDeviceOptions failed to unmarshal: unexpected end of JSON input" when it arrives while another request from the same device is rewriting options.json. Every attest request reads the options, and a nonce request rewrites them by truncating the file and then writing it, so a concurrent read can see an empty file and the request gets an HTTP 500. EVE then waits for its next retry, which delays onboarding. Device JSON files (options, config, attest certs, storage keys) are now written to a temporary file in the same directory and renamed over the target, so readers see either the old or the new content. Signed-off-by: eriknordmark <erik@zededa.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LvDPKeWJjD3ahjiJKF8b7f
milan-zededa
approved these changes
Oct 22, 2026
milan-zededa
left a comment
Contributor
There was a problem hiding this comment.
Sorry for a late review, LGTM.
4 of 7 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
An attest request can fail with
getDeviceOptions failed to unmarshal: unexpected end of JSON input(HTTP 500) when another request from the same device is rewritingoptions.json. Every attest request reads the options, and a nonce request rewrites them by truncating and then writing the file, so a concurrent read can see it empty. EVE retries later, but the delay was enough to fail evetest's two-minute config wait during onboarding.Device JSON files are now written to a temporary file in the same directory and renamed over the target. The new
OptionsReadDuringWriteIsCompletetest reads 0 bytes against the old code and passes with the change.🤖 Generated with Claude Code
https://claude.ai/code/session_01LvDPKeWJjD3ahjiJKF8b7f