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

disk import: Prioritize returning upload errors #992

Merged
merged 6 commits into from
Feb 3, 2025

Conversation

wfchandler
Copy link
Contributor

When sending chunks of the file to upload tasks, we return an error if the channel to that task is closed. This situation will happen if the upload task has panicked or already returned due to an error. However, we check for an error from the sending task first, and the failed to send chunks error will be surfaced to the user, rather than the true problem that occurred in the upload task.

In the inverse situation, where the reader fails, the uploaders will return gracefully when their channels are closed, so we do not need to worry about a problem reading the file showing up as an upload error.

Update our error handling to check for an error from the upload tasks, then the reader if those returned cleanly.

When sending chunks of the file to upload tasks, we return an error if
the channel to that task is closed. This situation will happen if the
upload task has panicked or already returned due to an error. However,
we check for an error from the sending task first, and the `failed to
send chunks` error will be surfaced to the user, rather than the true
problem that occurred in the upload task.

In the inverse situation, where the reader fails, the uploaders will
return gracefully when their channels are closed, so we do not need to
worry about a problem reading the file showing up as an upload error.

Update our error handling to check for an error from the upload tasks,
then the reader if those returned cleanly.
@wfchandler
Copy link
Contributor Author

Issue reported by a customer in https://oxidecomputer.slack.com/archives/C089VG8LHPG/p1738198958814399

@wfchandler wfchandler requested a review from ahl January 30, 2025 17:02
Copy link
Collaborator

@ahl ahl left a comment

Choose a reason for hiding this comment

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

What if there's a legitimate problem reading a file and there's a problem sending a chunk. I'd suggest we might want to look at both the results and read_result and say: "we had this 1 problem" or "there were several problems and these were they"

sdk/src/extras/disk.rs Outdated Show resolved Hide resolved
sdk/src/extras/disk.rs Outdated Show resolved Hide resolved
sdk/src/extras/disk.rs Show resolved Hide resolved
The index of the failed task doesn't provide more context to users and
might be accidentally construed as a backtrace. Just list the bare
errors for each failed request.

Also, use a standard `DiskImportError::context` if a single task failed.
If the file reader task fails to send a chunk to an upload task, we know
this is because that task has either returned due to an error or
panicked. In either case this isn't an error for the reader, which
should return early as the overall request will fail.
@wfchandler wfchandler requested a review from ahl January 30, 2025 20:22
The errors returned by a connection failure are long enough to wrap in
a user's terminal. Add a `*` to the start to make distinguishing errors
easier.
Copy link
Collaborator

@ahl ahl left a comment

Choose a reason for hiding this comment

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

good progress. I think the break Ok(()) is right from the send failure; nice comment.

sdk/src/extras/disk.rs Outdated Show resolved Hide resolved
sdk/src/extras/disk.rs Outdated Show resolved Hide resolved
sdk/src/extras/disk.rs Outdated Show resolved Hide resolved
cli/tests/test_disk_import.rs Outdated Show resolved Hide resolved
@wfchandler wfchandler requested a review from ahl January 31, 2025 15:48
@wfchandler wfchandler merged commit 521ff90 into main Feb 3, 2025
16 checks passed
@wfchandler wfchandler deleted the wc/upload-err-first branch February 3, 2025 16:15
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