Skip to content

PHD: fail active serial console waits if the serial websocket connection is lost #181

Open
@gjcolombo

Description

@gjcolombo

The serial console wait logic (see below) has no affordance to stop waiting and return an error if the serial console connection is lost.

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.

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;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request.testingRelated to testing and/or the PHD test framework.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions