openoffice: fix psutil usage in _releaseOpenOfficePort
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 self.run() File "cloudooo-repository/cloudooo/handler/ooo/monitor/request.py", line 60, in run self.openoffice.restart() File "cloudooo-repository/cloudooo/handler/ooo/application/application.py", line 79, in restart self.stop() File "cloudooo-repository/cloudooo/handler/ooo/application/openoffice.py", line 169, in stop self._releaseOpenOfficePort() 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.
Showing
-
mentioned in commit slapos@1867dda2
-
mentioned in commit slapos@4c2f610a
-
mentioned in commit slapos@2f1ab8ae
-
mentioned in commit slapos@c50f8ca3
-
mentioned in commit slapos@147a586a
-
mentioned in merge request nxdtest!9 (merged)
Please register or sign in to comment