Changeset 442c6a6 in mod_gnutls


Ignore:
Timestamp:
Jan 25, 2020, 6:26:19 AM (10 months ago)
Author:
Fiona Klute <fiona.klute@…>
Branches:
master, proxy-ticket
Children:
f4ac390e
Parents:
7543db4
Message:

Test suite: Detect Apache shutdown by PID file

Wait for the PID file to disappear instead of using signal 0. The
reason is that some container environments don't have a proper init
system which reaps the Apache process on shutdown. In that case the
process stays around as a zombie process and os.kill() reports it as
existing indefinitely.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • test/mgstest/services.py

    r7543db4 r442c6a6  
    109109            self.process.wait()
    110110            self.process = None
    111         elif self.pid:
    112             print(f'Waiting for PID {self.pid}...', file=sys.stderr)
     111        elif self.pid and self.pidfile:
     112            print(f'Waiting for PID {self.pid} to delete its PID file '
     113                  f'({self.pidfile})...', file=sys.stderr)
     114            sys.stderr.flush()
    113115            while True:
    114                 try:
    115                     # signal 0 just checks if the target process exists
    116                     os.kill(self.pid, 0)
     116                if self.pidfile.exists():
    117117                    sleep(self._step)
    118                 except OSError as e:
    119                     if e.errno != errno.ESRCH:
    120                         print('Unexpected exception while checking process '
    121                               f'state: {e}', file=sys.stderr)
     118                else:
    122119                    break
    123120            self.pid = None
Note: See TracChangeset for help on using the changeset viewer.