Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
cloudooo cloudooo
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Labels
    • Labels
  • Merge requests 7
    • Merge requests 7
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Operations
    • Operations
    • Environments
  • Analytics
    • Analytics
    • CI/CD
    • Repository
    • Value Stream
  • Members
    • Members
  • Activity
  • Graph
  • Jobs
  • Commits
Collapse sidebar
  • nexedi
  • cloudooocloudooo
  • Merge requests
  • !29

Merged
Created Apr 28, 2021 by Jérome Perrin@jeromeOwner

openoffice: fix psutil usage in _releaseOpenOfficePort

  • Overview 2
  • Commits 1
  • Pipelines 1
  • Changes 1

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.
Assignee
Assign to
Reviewer
Request review from
None
Milestone
None
Assign milestone
Time tracking
Source branch: fix/psutil
GitLab Nexedi Edition | About GitLab | About Nexedi | 沪ICP备2021021310号-2 | 沪ICP备2021021310号-7