KillFilter is unable to kill a process if the underlying file has been deleted

Bug #1482316 reported by Lars Kellogg-Stedman
22
This bug affects 5 people
Affects Status Importance Assigned to Milestone
oslo.rootwrap
Fix Released
Undecided
Pádraig Brady

Bug Description

I was seeing the following error from neutron's dhcp-agent:

  2015-08-06 13:20:06.507 16186 DEBUG neutron.agent.linux.utils [-] Running command (rootwrap daemon): ['kill', '-9', '23224'] execute_rootwrap_daemon /usr/lib/python2.7/site-packages/neutron/agent/linux/utils.py:100
  2015-08-06 13:20:06.778 16186 ERROR neutron.agent.dhcp.agent [-] Unable to enable dhcp for ff809ade-4935-48cb-8c1e-657a9ca58ca7.
  [...]
  2015-08-06 13:20:06.778 16186 TRACE neutron.agent.dhcp.agent raise convert_to_error(kind, result)
  2015-08-06 13:20:06.778 16186 TRACE neutron.agent.dhcp.agent NoFilterMatched

That pid (23224) does refer to an active dnsmasq process:

  # ps -p 23224 -f|cat
  UID PID PPID C STIME TTY TIME CMD
  nobody 23224 1 0 09:31 ? 00:00:00 dnsmasq --no-hosts --no-resolv --strict-order --bind-interfaces ...

But the "dnsmasq" package had been updated after that process started,
so /proc/23224/exe is:

  lrwxrwxrwx. 1 root root 0 Aug 6 09:31 /proc/23224/exe -> /usr/sbin/dnsmasq;55c362c5 (deleted)

KillFilter should probably be able to deal with this situation.

Revision history for this message
Lars Kellogg-Stedman (larsks) wrote :

Okay, so the problem here isn't just a *deleted* file; it's one that is first *renamed*, then deleted.

Revision history for this message
Pádraig Brady (p-draigbrady) wrote :

Interesting. This should have been fixed with bug 1179793 back before oslo.rootwrap was split out?

Revision history for this message
Lars Kellogg-Stedman (larsks) wrote :

No, bug 1179793 is addressing a different problem.

In this case, the file is first *renamed* (by rpm, in this case), then deleted. The renamed file does not match the KillFilter specified values.

Changed in oslo.rootwrap:
assignee: nobody → Pádraig Brady (p-draigbrady)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to oslo.rootwrap (master)

Fix proposed to branch: master
Review: https://review.openstack.org/210541

Changed in oslo.rootwrap:
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to oslo.rootwrap (master)

Reviewed: https://review.openstack.org/210541
Committed: https://git.openstack.org/cgit/openstack/oslo.rootwrap/commit/?id=e5f9a393ced38e2bccfd5c626cebcb036192be71
Submitter: Jenkins
Branch: master

commit e5f9a393ced38e2bccfd5c626cebcb036192be71
Author: Pádraig Brady <email address hidden>
Date: Fri Aug 7 17:12:25 2015 +0100

    Handle renamed executables with KillFilter

    A running process may refer to a renamed executable
    referenced by /proc/$pid/exe, which happens with
    updated executables on RPM based systems.
    In that case we defer to the path in /proc/$pid/cmdline
    if it exists.

    Change-Id: I113f2f8ebd56f3b05c420310c4b1e84ba6f17fcf
    Closes-Bug: 1482316

Changed in oslo.rootwrap:
status: In Progress → Fix Committed
Changed in oslo.rootwrap:
milestone: none → 2.3.0
status: Fix Committed → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/oslo.rootwrap 2.3.0

This issue was fixed in the openstack/oslo.rootwrap 2.3.0 release.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.