Skip to content

Commit

Permalink
zdtm: Treat ESRCH from kill() as success.
Browse files Browse the repository at this point in the history
This fixes failure to clean up after a failed test, where CRIU didn't start properly.

```
===================== Run zdtm/transition/socket-tcp in h ======================
Start test
./socket-tcp --pidfile=socket-tcp.pid --outfile=socket-tcp.out
Traceback (most recent call last):
  File "/tmp/vex/work/zdtm_py.par/google3/third_party/criu/v3_17/zdtm_py.py", line 1906, in do_run_test
    cr(cr_api, t, opts)
  File "/tmp/vex/work/zdtm_py.par/google3/third_party/criu/v3_17/zdtm_py.py", line 1584, in cr
    cr_api.dump("dump")
  File "/tmp/vex/work/zdtm_py.par/google3/third_party/criu/v3_17/zdtm_py.py", line 1386, in dump
    self.__dump_process = self.__criu_act(action,
  File "/tmp/vex/work/zdtm_py.par/google3/third_party/criu/v3_17/zdtm_py.py", line 1224, in __criu_act
    raise test_fail_exc("CRIU %s" % action)
test_fail_exc: CRIU dump

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<embedded module '_launcher'>", line 182, in run_filename_from_loader_as_main
  File "<embedded module '_launcher'>", line 34, in _run_code_in_main
  File "/tmp/vex/work/zdtm_py.par/google3/third_party/criu/v3_17/zdtm_py.py", line 2790, in <module>
    fork_zdtm()
  File "/tmp/vex/work/zdtm_py.par/google3/third_party/criu/v3_17/zdtm_py.py", line 2782, in fork_zdtm
    do_run_test(tinfo[0], tinfo[1], tinfo[2], tinfo[3])
  File "/tmp/vex/work/zdtm_py.par/google3/third_party/criu/v3_17/zdtm_py.py", line 1922, in do_run_test
    t.kill()
  File "/tmp/vex/work/zdtm_py.par/google3/third_party/criu/v3_17/zdtm_py.py", line 509, in kill
    os.kill(int(self.__pid), sig)
ProcessLookupError: [Errno 3] No such process
```

Signed-off-by: Michał Mirosław <[email protected]>
  • Loading branch information
osctobe committed Aug 1, 2023
1 parent 43470ce commit fe23dd1
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions test/zdtm.py
Original file line number Diff line number Diff line change
Expand Up @@ -507,8 +507,14 @@ def kill(self, sig=signal.SIGKILL):
self.__freezer.thaw()
if self.__pid:
print("Send the %d signal to %s" % (sig, self.__pid))
os.kill(int(self.__pid), sig)
self.gone(sig == signal.SIGKILL)
try:
os.kill(int(self.__pid), sig)
except ProcessLookupError:
# Prevent gone() calling waitpid().
self.auto_reap = True
self.gone(True)
else:
self.gone(sig == signal.SIGKILL)

self.__flavor.fini()

Expand Down

0 comments on commit fe23dd1

Please sign in to comment.