diff options
author | Eelco Dolstra <edolstra@gmail.com> | 2020-05-07 15:20:34 +0200 |
---|---|---|
committer | Eelco Dolstra <edolstra@gmail.com> | 2020-05-07 15:25:24 +0200 |
commit | 78f2a830291eb19af6306476b186b585f4d9cd37 (patch) | |
tree | 845960179c3d9bfc2f0fb03a777aa57e9f872c52 /nixos/lib/test-driver | |
parent | ecdb5c4320c6897484f6f11ee05b2eaca3382cd2 (diff) |
test-driver.py: Fix deadlock when the log queue gets full
If a program (e.g. nixos-install) writes more than 1000 lines to stderr during execute(), then process_serial_output() deadlocks waiting for the queue to be processed. So use an unbounded queue instead. We should probably get rid of the structured log output (log.xml), since then we don't need the log queue anymore.
Diffstat (limited to 'nixos/lib/test-driver')
-rw-r--r-- | nixos/lib/test-driver/test-driver.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/nixos/lib/test-driver/test-driver.py b/nixos/lib/test-driver/test-driver.py index d96600b3c9909..84661a4a758c9 100644 --- a/nixos/lib/test-driver/test-driver.py +++ b/nixos/lib/test-driver/test-driver.py @@ -143,7 +143,7 @@ class Logger: self.logfile = os.environ.get("LOGFILE", "/dev/null") self.logfile_handle = codecs.open(self.logfile, "wb") self.xml = XMLGenerator(self.logfile_handle, encoding="utf-8") - self.queue: "Queue[Dict[str, str]]" = Queue(1000) + self.queue: "Queue[Dict[str, str]]" = Queue() self.xml.startDocument() self.xml.startElement("logfile", attrs={}) @@ -391,11 +391,11 @@ class Machine: def execute(self, command: str) -> Tuple[int, str]: self.connect() - out_command = "( {} ); echo '|!EOF' $?\n".format(command) + out_command = "( {} ); echo '|!=EOF' $?\n".format(command) self.shell.send(out_command.encode()) output = "" - status_code_pattern = re.compile(r"(.*)\|\!EOF\s+(\d+)") + status_code_pattern = re.compile(r"(.*)\|\!=EOF\s+(\d+)") while True: chunk = self.shell.recv(4096).decode(errors="ignore") |