Bug 1640259 - Add EPERM(Operation not permitted) as an expected error in isPidAlive() check. r=ahal

We could hit this error if we open and close too many processes during
the test. This could happen when Fission is enabled. The pid number
could roll back to 1 if the pid is counted over than 32767 in linux. If
this happened, we might check the pid which is opened by others. For
example, we open and close the pid 1000 and after that the pid rolls back
to 1  and the pid 1000 has been used by other process for any reasons.
If this happens, we would hit this error during killing zombie processes
in the end of the test.

To resolve this, we can add EPERM as an expected error since this
indicates that this pid has been used by other process, so the pid of the
original process is no longer alive.

Differential Revision: https://phabricator.services.mozilla.com/D76692
This commit is contained in:
Tim Huang 2020-05-26 19:23:29 +00:00
parent e58eecbd3e
commit 3bfc60d466

View File

@ -438,7 +438,7 @@ else:
except OSError as err:
# Catch the errors we might expect from os.kill/os.waitpid,
# and re-raise any others
if err.errno == errno.ESRCH or err.errno == errno.ECHILD:
if err.errno in (errno.ESRCH, errno.ECHILD, errno.EPERM):
return False
raise
# TODO: ^ upstream isPidAlive to mozprocess