Stale pid files exist after metadata namespace proxy is terminated

Bug #1223250 reported by Darragh O'Reilly
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
neutron
Fix Released
Medium
Darragh O'Reilly

Bug Description

These pid files are not removed when shutdown sents SIGTERM.

$ ps -ef | grep metadata-proxy
root 17725 1 0 07:05 ? 00:00:00 /usr/bin/python /usr/local/bin/neutron-ns-metadata-proxy --pid_file=/opt/stack/data/neutron/external/pids/a1752c3b-cf08-4155-a268-e97ca5320221.pid --metadata_proxy_socket=/opt/stack/data/neutron/metadata_proxy --router_id=a1752c3b-cf08-4155-a268-e97ca5320221 --state_path=/opt/stack/data/neutron --metadata_port=9697 --debug --verbose

$ ls -l /opt/stack/data/neutron/external/pids/a1752c3b-cf08-4155-a268-e97ca5320221.pid
-rwxr-xr-x 1 root root 5 Sep 10 07:05 /opt/stack/data/neutron/external/pids/a1752c3b-cf08-4155-a268-e97ca5320221.pid

$ sudo kill 17725

$ ls -l /opt/stack/data/neutron/external/pids/a1752c3b-cf08-4155-a268-e97ca5320221.pid
-rwxr-xr-x 1 root root 5 Sep 10 07:05 /opt/stack/data/neutron/external/pids/a1752c3b-cf08-4155-a268-e97ca5320221.pid

In daemon.py delete_pid() is registerd with atexit.register() to remove the pid file when the process exits. https://github.com/openstack/neutron/blob/2013.2.b3/neutron/agent/linux/daemon.py#L125

But the atexit man page says: "Functions registered using atexit() (and on_exit(3)) are not called if a process terminates abnormally because of the delivery of a signal."

Tags: metadata
Changed in neutron:
assignee: nobody → Darragh O'Reilly (darragh-oreilly)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to neutron (master)

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

Changed in neutron:
status: New → In Progress
Changed in neutron:
importance: Undecided → Medium
milestone: none → havana-rc1
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to neutron (master)

Reviewed: https://review.openstack.org/45831
Committed: http://github.com/openstack/neutron/commit/4535505fc1ee6aae49f3b054cffd48b88f062e31
Submitter: Jenkins
Branch: master

commit 4535505fc1ee6aae49f3b054cffd48b88f062e31
Author: Darragh O'Reilly <email address hidden>
Date: Tue Sep 10 09:06:28 2013 +0000

    Ensure pid file is removed when metadata ns daemon receives SIGTERM

    These files from the metadata namespace proxy are not being removed
    because delete_pid() is registered with atexit. This means it only runs
    when a process exits normally and won't run when a process receives a
    signal.

    This patch registers a signal handler for SIGTERM that calls exit()
    to make the process exit normally so delete_pid() gets called.

    Fixes bug: 1223250

    Change-Id: I6309802e2109359560ccc084559ec8e4d310cce2

Changed in neutron:
status: In Progress → Fix Committed
tags: added: metadata
Thierry Carrez (ttx)
Changed in neutron:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in neutron:
milestone: havana-rc1 → 2013.2
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.