-
-
Notifications
You must be signed in to change notification settings - Fork 14.4k
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
nixos/test-driver: Fix thread cleanup and execute #142560
Conversation
This seems to resolve a deadlock when shutting down a test while the QEMU process is hanging (which it seems to be doing consistently on Hydra, and not anywhere else I've tested). Also a few assorted cleanups to ensure we can't get deadlocked receiving outputs from a command. |
@GrahamcOfBorg test simple switchTest |
output += match[1] | ||
status_code = int(match[2]) | ||
return (status_code, output) | ||
chunk = self.shell.recv(4096) | ||
output += chunk |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oof, we may also want to do something about the quadratic complexity here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ideally we'd want some sort of an incremental matcher, but in my limited testing, it seems like it's not really an issue - outputs don't generally exceed 4k, and even when they do, they don't exceed 8k.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As a "solution" we could split this into two commands:
f"( set -euo pipefail; {command} ); echo "$?" > /.nixos-test-runner-exit-code\n"
"cat /.nixos-test-runner-exit-code"
This way we can get rid of the entire matching stuff
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we do that, we could just use echo $?
as the second command.
|
||
while True: | ||
chunk = self.shell.recv(4096).decode(errors="ignore") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, is there a reason we are no longer ignoring errors?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It shouldn't be necessary if we can no longer end up on a character boundary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess there's a technicality here: a command could potentially output complete garbage, but in that case I'd much rather have it crash than return something that makes no sense.
The thing that is blocking the channel is fixed here: #142675, we can refactor |
Closing this since I reimplemented |
Motivation for this change
The unstable channel is blocked by the test runner hanging in cleanup.
This is not my change, it was written by @K900 and I don't fully understand why it fixes things but it seems to make the test runner exit which it is currently not doing.
Things done
sandbox = true
set innix.conf
? (See Nix manual)nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
./result/bin/
)