You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Recently I just took a look on that, and it turns out that the issues are related to Spawn.__del__ dealing with some conditions (e.g. sys.exit, handling signals ...). So here comes a question: can we provide a method to explicitly perform Spawn.__del__ instead, or is it possible to make __del__ bug free in our case?
Here is a simple reproducer to trigger the issues easier.
(Note: the worst case here is the program would be stuck at SystemExit: 0, but fortunately so far this rarely happens during test executions.)
$ for i in {1..10}; do python2.7 r.py; done
Exception RuntimeError: RuntimeError('cannot join thread before it is started',) in <bound method Foo.__del__ of <__main__.Foo object at 0x7f782105bf10>> ignored
Exception AttributeError: "'Foo' object has no attribute 'thread'" in <bound method Foo.__del__ of <__main__.Foo object at 0x7fa57c99f250>> ignored
Exception AttributeError: "'Foo' object has no attribute 'thread'" in <bound method Foo.__del__ of <__main__.Foo object at 0x7f238a745f10>> ignored
Exception SystemExit: 0 in <bound method Foo.__del__ of <__main__.Foo object at 0x7f2a6aca3090>> ignored
...
$ for i in {1..10}; do python3.9 r.py; done
Exception ignored in: <function Foo.__del__ at 0x7efff607c280>
Traceback (most recent call last):
File "/tmp/r.py", line 21, in __del__
self.close()
File "/tmp/r.py", line 24, in close
self.thread.join()
AttributeError: 'Foo' object has no attribute 'thread'
Exception ignored in: <function Foo.__del__ at 0x7fed8e99a280>
Traceback (most recent call last):
File "/tmp/r.py", line 21, in __del__
File "/tmp/r.py", line 24, in close
File "/usr/lib64/python3.9/threading.py", line 1028, in join
RuntimeError: cannot join thread before it is started
Exception ignored in: <function Foo.__del__ at 0x7f1895342280>
Traceback (most recent call last):
File "/tmp/r.py", line 21, in __del__
self.close()
File "/tmp/r.py", line 24, in close
self.thread.join()
File "/usr/lib64/python3.9/threading.py", line 1033, in join
self._wait_for_tstate_lock()
File "/usr/lib64/python3.9/threading.py", line 1051, in _wait_for_tstate_lock
self._stop()
File "/usr/lib64/python3.9/threading.py", line 989, in _stop
with _shutdown_locks_lock:
File "/tmp/r.py", line 10, in exit
sys.exit(0)
SystemExit: 0
...
The text was updated successfully, but these errors were encountered:
Hello @luckyh, thank you for the analysis, I am seeing similar issues in my testing as well and it is annoying. Unfortunately I don't know how to treat this properly on the Aexpect side, maybe it'd be worth trying to raise this in the python community and ask for help there (either directly upstream or in RH BZ I bet there would be people that would be able to suggest a better approach). Can you please give it a try? With your reproducer it should be easy to grasp and it seems to basically explain the Aexpect usage.
As for workarounds, in Avocado-vt I am using timeout -s SIGINT $CTRL_C_TIMEOUT timeout $KILL_TIMEOUT avocado run ..., which seems to work well as it first tries to use ctrl+c and only in case of a complete hang forcefully interrupt the testing.
In other project I am using a tweak directly in the app which ensures properly killed background threads:
For years I had seen a few odd issues, for instances:
Recently I just took a look on that, and it turns out that the issues are related to
Spawn.__del__
dealing with some conditions (e.g.sys.exit
, handling signals ...). So here comes a question: can we provide a method to explicitly performSpawn.__del__
instead, or is it possible to make__del__
bug free in our case?Here is a simple reproducer to trigger the issues easier.
(Note: the worst case here is the program would be stuck at
SystemExit: 0
, but fortunately so far this rarely happens during test executions.)The text was updated successfully, but these errors were encountered: