-
Notifications
You must be signed in to change notification settings - Fork 34
Description
The serial console wait logic (see below) has no affordance to stop waiting and return an error if the serial console connection is lost.
propolis/phd-tests/framework/src/serial/vt100.rs
Lines 122 to 131 in 5a6a332
| if guard.wait_buffer.ends_with(&waiter.wanted) { | |
| let new_length = guard.wait_buffer.len() - waiter.wanted.len(); | |
| guard.wait_buffer.truncate(new_length); | |
| let out = guard.wait_buffer.drain(..).collect(); | |
| // This can race such that the last character satisfying a wait | |
| // arrives just as the waiter times out and closes its half of | |
| // the channel. There's nothing to be done about this, so ignore | |
| // any errors here. | |
| let _ = waiter.output_tx.send(out).await; |
While wait-for-serial operations have a timeout, this can be long (5 minutes in the wait-to-boot case), so it's a bummer to have to wait it out if the VM is just totally gone (e.g. because the test did something that made the server panic).
The serial console websocket listener (below) can detect this case and send a message on its output_tx telling the VT processor (which actually handles the waits) that the connection is gone, allowing the listener to send a failure message/close its end of the channel/whatever behavior we decide is most appropriate.
propolis/phd-tests/framework/src/serial/mod.rs
Lines 29 to 41 in 5a6a332
| Some(Ok(Message::Binary(bytes))) => { | |
| if output_tx.send(bytes).await.is_err() { | |
| break; | |
| } | |
| }, | |
| Some(Ok(Message::Close(..))) => { | |
| info!("Serial socket closed"); | |
| break; | |
| }, | |
| None => { | |
| info!("Serial socket returned None"); | |
| break; | |
| } |