Skip to content

GitLab

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

Merged
Created Oct 19, 2023 by Jérome Perrin@jeromeOwner

testnode: make killall support processes with changed title

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

testnode uses ProcessManager.killall to terminate all processes from a path. To determine if a process is from a path, it looks at the command line. This does not work for processes using setproctitle to change their command line.

We can see in ps:

$ ps -edf | grep nginx
slapuse+ 115059  45574  0 16:14 ?        00:00:00 nginx: master process /srv/slapgrid/slappart46/t/cvt/i/0/tmp/shared/nginx/6d79cb0e7d81dce1be97eec8a5712f08/sbin/nginx -c /srv/slapgrid/slappart46/t/cvt/i/0/tmp/inst/T-0/etc/nginx-master-introspection.conf
slapuse+ 115090 115059  0 16:14 ?        00:00:00 nginx: worker process

or by looking at cmdline, which is what psutil.Process.cmdline is using:

$ cat /proc/115090/cmdline
nginx: worker process

and that's why sometimes when cancelling a software release test while it is running tests from a software using nginx, some processes are leaked, they keep using the port and next test running on this testnode fail.

In that case, killall is called with /srv/slapgrid/slappart46/t/cvt , we can not find such process with cmdline, but we can extend this heuristic to use the current working directory:

$ ls -al /proc/115090/cwd
lrwxrwxrwx 1 slapuser46 slapuser46 0 Oct 19 16:16 /proc/115090/cwd -> /srv/slapgrid/slappart46/t/cvt/i/0/tmp/inst/T-0

This also applies an optimization of only considering processes of the current unix user.

Assignee
Assign to
Reviewer
Request review from
None
Milestone
None
Assign milestone
Time tracking
Source branch: fix/testnode_proctitle
GitLab Nexedi Edition | About GitLab | About Nexedi | 沪ICP备2021021310号-2 | 沪ICP备2021021310号-7