• Jérome Perrin's avatar
    openoffice: fix psutil usage in _releaseOpenOfficePort · 0b5ff71a
    Jérome Perrin authored
    This uses psutil.process_iter to iterate on all processes, but in the meantime
    some process might terminate.
    As we could observe in the logs:
        2021-04-26 12:53:02 - Cloudooo - DEBUG - Stop Pid - 15816
        Exception in thread Thread-1:
        Traceback (most recent call last):
          File "python2.7/lib/python2.7/threading.py", line 801, in __bootstrap_inner
          File "cloudooo-repository/cloudooo/handler/ooo/monitor/request.py", line 60, in run
          File "cloudooo-repository/cloudooo/handler/ooo/application/application.py", line 79, in restart
          File "cloudooo-repository/cloudooo/handler/ooo/application/openoffice.py", line 169, in stop
          File "cloudooo-repository/cloudooo/handler/ooo/application/openoffice.py", line 122, in _releaseOpenOfficePort
            if process.exe() == join(self.office_binary_path, self._bin_soffice):
          File "psutil-5.8.0-py2.7-linux-x86_64.egg/psutil/__init__.py", line 660, in exe
            exe = self._proc.exe()
          File "psutil-5.8.0-py2.7-linux-x86_64.egg/psutil/_pslinux.py", line 1688, in exe
            raise NoSuchProcess(self.pid, self._name)
        NoSuchProcess: psutil.NoSuchProcess process no longer exists (pid=19382)
    Update to catch and ignore such exceptions, and minor refactorings such as:
     - Not calculate the path of openoffice binary in the loop, this is not
       supposed to change.
     - Remove reference to lsof in logged message, this does not use lsof.
     - Catch all exceptions.
Last commit
Last update
cloudooo Loading commit data...
.gitignore Loading commit data...
CHANGELOG.rst Loading commit data...
COPYING Loading commit data...
MANIFEST.in Loading commit data...
NEWS Loading commit data...
README.rst Loading commit data...
setup.py Loading commit data...