From 2b74699d3592ca1a521fae5ff6f0ca90a1fa421c Mon Sep 17 00:00:00 2001 From: Steven Li Date: Thu, 27 Aug 2020 04:47:43 +0000 Subject: [PATCH] Adjusted crash_gen tool to tolerate non UTF8 server output --- tests/pytest/crash_gen.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/pytest/crash_gen.py b/tests/pytest/crash_gen.py index f67aeaf00e..fd48edae05 100755 --- a/tests/pytest/crash_gen.py +++ b/tests/pytest/crash_gen.py @@ -166,7 +166,7 @@ class WorkerThread: self.useDb() # might encounter exceptions. TODO: catch except taos.error.ProgrammingError as err: errno = Helper.convertErrno(err.errno) - if errno == 0x383 : # invalid database + if errno in [0x383, 0x386, 0x00B, 0x014] : # invalid database, dropping, Unable to establish connection, Database not ready # ignore dummy = 0 else: @@ -2442,7 +2442,11 @@ class ServiceManagerThread: for line in iter(out.readline, b''): # print("Finished reading a line: {}".format(line)) # print("Adding item to queue...") - line = line.decode("utf-8").rstrip() + try: + line = line.decode("utf-8").rstrip() + except UnicodeError: + print("\nNon-UTF8 server output: {}\n".format(line)) + # This might block, and then causing "out" buffer to block queue.put(line) self._printProgress("_i") -- GitLab