Clear feedback connection buffer.
This follow the PR !1317 (merged).
We now use different namespace to let the output to pexpect PTY, which could quickly be fetched by
But when expect, the pexpect buffer still never be cleared, which make us encountered a big issue: the cpu and memory may increase during the increase of buffer size, to match in whole buffer etc., finally the pc becomes very slow, then the zeromq connection seems also dropped. (NOTE: I'm talking about some stress test which will run very long, and currently we only encountered in docker-test-shell related scenario, for our android test, for our uboot test which written in python...)
A buffer clean looks make no harm to current code & also resolve our issue. Meanwhile, the old solution will continue to print
Listened to connection for namespace 'prepare' done, even there is nothing print.
feedback print will be in
feedback color, so looks no need it, the only item I think is: if we have multiple feedback connection, then this print could be used to distinguish the print from different feedback.
So, a corresponding change here is: if there is content from this feedback, then print
Listened to connection for namespace 'prepare' done, if not, don't print it. You know, in a stress job, a lots of unused
Listened to connection for namespace 'prepare' done will make the job log > 5M which will hide the output.
And next is a small script which could be used to describe the cpu/memory issue:
import pexpect p = pexpect.spawn("yes", encoding="utf-8") p.logfile = sys.stdout while True: try: p.expect([pexpect.EOF, pexpect.TIMEOUT], timeout=1) #p.expect([".+", pexpect.EOF, pexpect.TIMEOUT], timeout=1) except Exception as e: print(e)