Neutron agents process name changed after neutron-server setproctitle change

Bug #1881297 reported by Bernard Cafarelli
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
neutron
Fix Released
Low
Unassigned

Bug Description

In bug 1816485 we pushed code [0] to have nice process names for neutron-server workers (indicating RPC workers, ...). This was done via setproctitle.

Code itself does not affect other neutron components, but simply loading the setproctitle module will affect the process environment [1] in /proc/xx/environ.

This is quite visible when checking "ps -e" output, form:
# ps -e|grep neutron
 4712 ? 00:00:02 neutron-openvsw
 4775 ? 00:00:00 neutron-rootwra
 4821 ? 00:00:02 neutron-dhcp-ag
 4852 ? 00:00:01 neutron-l3-agen
 4932 ? 00:00:00 neutron-rootwra
 5790 ? 00:00:02 neutron-server
 5844 ? 00:00:00 neutron-server
 5845 ? 00:00:00 neutron-server

to:
# ps -e|grep neutron
28447 ? 00:00:00 neutron-rootwra
28805 ? 00:00:00 neutron-server:
28806 ? 00:00:00 neutron-server:
28807 ? 00:00:00 neutron-server:
31253 ? 00:00:00 neutron-rootwra

A shorter test, "ps -e | grep $(pgrep -f neutron-openvswitch-agent)" reported neutron-openvswitch-agent in old systems, and now pythonx.x

Using setproctitle's SPT_NOENV feature to avoid clobbering does not work as proper environment name is the full "/usr/bin/python3.6 /usr/local/bin/neutron-openvswitch-agent --config-file /etc/neutron/neutron.conf --config-file /etc/neutron/plugins/ml2/ml2_conf.in" (or local equivalent)

While using other toosl (or ps options) to find the agent process work fine, some monitoring solutions only work on env name like "ps -e" output

As we added process names for neutron-keepalived-state-change [2], I think the "best of both ways" fix would be to set process names in agents starting, with a format like "neutron-openvswitch-agent ($original_proc_title)"

Bonus question: I wonder about backportability of such a fix, as it keeps old process name it should be mostly backwards-compatible and helps with other use-cases, but it may break for those using exact matchin

[0] https://review.opendev.org/#/c/637019/
[1] https://pypi.org/project/setproctitle/
[2] https://review.opendev.org/#/c/660905/

Changed in neutron:
importance: Undecided → Low
Changed in neutron:
assignee: nobody → Bernard Cafarelli (bcafarel)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to neutron (master)

Fix proposed to branch: master
Review: https://review.opendev.org/735125

Changed in neutron:
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix proposed to neutron-lib (master)

Related fix proposed to branch: master
Review: https://review.opendev.org/735578

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix merged to neutron-lib (master)

Reviewed: https://review.opendev.org/735578
Committed: https://git.openstack.org/cgit/openstack/neutron-lib/commit/?id=8294ae6077d1fdee81c673cf094722d62f44d082
Submitter: Zuul
Branch: master

commit 8294ae6077d1fdee81c673cf094722d62f44d082
Author: Bernard Cafarelli <email address hidden>
Date: Mon Jun 15 14:40:14 2020 +0200

    Add agent process name constants alongside type

    Process name is already used for binary field in agents list and will be
    used to set process name itself

    Also sorted the agent types

    Change-Id: Ia614f40ca60f68c53d49bb1b0b6a58b20840c7fe
    Related-Bug: #1881297

Changed in neutron:
assignee: Bernard Cafarelli (bcafarel) → Brian Haley (brian-haley)
Changed in neutron:
assignee: Brian Haley (brian-haley) → Bernard Cafarelli (bcafarel)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to neutron (master)

Reviewed: https://review.opendev.org/735125
Committed: https://git.openstack.org/cgit/openstack/neutron/commit/?id=5ce0595803e72157a82f086b520f454786100872
Submitter: Zuul
Branch: master

commit 5ce0595803e72157a82f086b520f454786100872
Author: Bernard Cafarelli <email address hidden>
Date: Thu Jun 11 14:20:49 2020 +0200

    Set process name for agents

    Now that we use setproctitle for neutron-server workers (and
    neutron-keepalived-state-change), this has the side effect of changing
    the process name for agents, impacting some monitoring systems. More
    details in launchpad bug.

    This patch fixes it by setting the name with setproctitle to:
    agent name (original process name).

    Also use the newly introduced name constants to replace existing
    hardcoded uses.

    Change-Id: I74c3a4d3e9f833752571a75f196560cd45529385
    Closes-Bug: #1881297

Changed in neutron:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to neutron (stable/ussuri)

Fix proposed to branch: stable/ussuri
Review: https://review.opendev.org/752114

Revision history for this message
Slawek Kaplonski (slaweq) wrote : auto-abandon-script

This bug has had a related patch abandoned and has been automatically un-assigned due to inactivity. Please re-assign yourself if you are continuing work or adjust the state as appropriate if it is no longer valid.

Changed in neutron:
assignee: Bernard Cafarelli (bcafarel) → nobody
tags: added: timeout-abandon
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on neutron (stable/ussuri)

Change abandoned by "Slawek Kaplonski <email address hidden>" on branch: stable/ussuri
Review: https://review.opendev.org/c/openstack/neutron/+/752114
Reason: This review is > 4 weeks without comment, and failed Zuul jobs the last time it was checked. We are abandoning this for now. Feel free to reactivate the review by pressing the restore button and leaving a 'recheck' comment to get fresh test results.

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.