Changeset 215346 in webkit


Ignore:
Timestamp:
Apr 13, 2017 4:20:03 PM (7 years ago)
Author:
Jonathan Bedard
Message:

webkitpy: Ignore previously launched pid when system is under stress
https://bugs.webkit.org/show_bug.cgi?id=170741

Reviewed by David Kilzer.

We have seen cases where xcrun simctl launch will return a pid of a previous
process and the process will appear to be running even though it is crashing.
Ensure that the PID that simulator_process is receiving is not the pid of the
previously run process.

  • Scripts/webkitpy/port/simulator_process.py:

(SimulatorProcess._start): Check to make sure we aren't receiving an old PID.

Location:
trunk/Tools
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r215334 r215346  
     12017-04-13  Jonathan Bedard  <jbedard@apple.com>
     2
     3        webkitpy: Ignore previously launched pid when system is under stress
     4        https://bugs.webkit.org/show_bug.cgi?id=170741
     5
     6        Reviewed by David Kilzer.
     7
     8        We have seen cases where xcrun simctl launch will return a pid of a previous
     9        process and the process will appear to be running even though it is crashing.
     10        Ensure that the PID that simulator_process is receiving is not the pid of the
     11        previously run process.
     12
     13        * Scripts/webkitpy/port/simulator_process.py:
     14        (SimulatorProcess._start): Check to make sure we aren't receiving an old PID.
     15
    1162017-04-13  Jonathan Bedard  <jbedard@apple.com>
    217
  • trunk/Tools/Scripts/webkitpy/port/simulator_process.py

    r214965 r215346  
    9191        # 3 client connections will be accepted for stdin, stdout and stderr in that order.
    9292        self._target_host.listening_socket.listen(3)
    93         self._pid = self._target_host.launch_app(self._bundle_id, self._cmd[1:], env=self._env)
     93
     94        try:
     95
     96            def launch_failure_handler(signum, frame):
     97                assert signum == signal.SIGALRM
     98                raise RuntimeError('Faild to launch {}, kept receiving old PID'.format(os.path.basename(self._cmd[0])))
     99
     100            signal.signal(signal.SIGALRM, launch_failure_handler)
     101            signal.alarm(300)  # In seconds
     102            pid = self._pid
     103            while pid == self._pid:
     104                if pid:
     105                    self._target_host.executive.kill_process(pid)
     106                pid = self._target_host.launch_app(self._bundle_id, self._cmd[1:], env=self._env)
     107            self._pid = pid
     108        finally:
     109            signal.alarm(0)
    94110
    95111        def handler(signum, frame):
    96112            assert signum == signal.SIGALRM
    97             raise Exception('Timed out waiting for pid {} to connect at port {}'.format(self._pid, self._target_host.listening_port()))
     113            raise RuntimeError('Timed out waiting for pid {} to connect at port {}'.format(self._pid, self._target_host.listening_port()))
    98114        signal.signal(signal.SIGALRM, handler)
    99115        signal.alarm(6)  # In seconds
Note: See TracChangeset for help on using the changeset viewer.