Repository navigation
[7/n] [installinator] write out zone hashes to a new zones.json file - #8155
Conversation
Created using spr 1.3.6-beta.1
| /// Computes the zone hash IDs. | ||
| /// | ||
| /// Hash computation is done in parallel on blocking tasks. If a task panics | ||
| /// (should not happen in normal use), a `JoinError` is returned. |
There was a problem hiding this comment.
Do we need to return an error at all? I think we've pretty liberally unwrapped tokio::spawn() await points where there's obviously no cancellation possible, because that means
(a) in prod we would have aborted due to the task panic anyway
(b) in dev we only propagate other panics
right? This seems pretty similar.
There was a problem hiding this comment.
A JoinError can also happen due to a runtime shutdown, not just a panic. Since installinator is pretty autonomous I wanted to make sure that errors were reported up to wicket. wdyt?
There was a problem hiding this comment.
I guess something I could do is to check whether the JoinError is a panic, and if so, panic as you suggested. If it's a cancellation then report that.
There was a problem hiding this comment.
Ehhh, what would cause the runtime to shutdown, in practice? We're running under a #[tokio::main], right?
There was a problem hiding this comment.
Oh, if we have tests that exercise this and we might hit the whole "runtime cancels tasks in a random order when test ends" thing, then maybe we don't want to panic here. But I don't know that it's worth doing work to bubble any kind of error up to wicket for a case that's only possible in tests.
There was a problem hiding this comment.
Do you feel like it's a lot of work? I'm just generally concerned with dead air from a hard-to-introspect service I guess.
There was a problem hiding this comment.
No, it's not a lot of work. But handling this error in this way is pretty different from how we handle tokio JoinErrors in general. E.g., even from within installinator:
omicron/installinator-common/src/raw_disk_writer.rs
Lines 86 to 97 in 03081e1
I don't think handling this error is wrong. I just think it's weird when we don't bother to most anywhere else, and it's unfortunate to make an otherwise-infallible function return a Result.
There was a problem hiding this comment.
All right, addressed.
| let file_name = file_name.clone(); | ||
| // data is a Bytes so is cheap to clone. | ||
| let data: Bytes = data.clone(); | ||
| // Compute hashes in parallel. |
There was a problem hiding this comment.
Should this use JoinSet::spawn_blocking() since this work is synchronous and compute bound? (I assume collect() does the equivalent of JoinSet::spawn()?)
There was a problem hiding this comment.
It should, I started off with that but got too clever by half, whoops. Fixed.
Created using spr 1.3.6-beta.1
Created using spr 1.3.6-beta.1
Created using spr 1.3.6-beta.1
Created using spr 1.3.6-beta.1
Created using spr 1.3.6-beta.1
Created using spr 1.3.6-beta.1
Created using spr 1.3.6-beta.1 [skip ci]
Created using spr 1.3.6-beta.1
Created using spr 1.3.6-beta.1
Created using spr 1.3.6-beta.1
Part of RFD 556. In upcoming work, sled-agent will check these hashes at boot time, and mark an error if there's a mismatch.
The stack was tested on a racklette.