Skip to content

restarting supervisor fails #47

@JMLX42

Description

@JMLX42

The current handler implementation fails "sometimes" because Ansible will not call:

service supervisor restart

but will call something like this instead:

service supervisor stop && service supervisor start

This will fail "sometimes" because supervisor programs (and supervisor itself) are not completely stopped when service supervisor stop returns. Then, when service supervisor start is called immediately, it will fail.

See this post: https://stackoverflow.com/questions/32738415/supervisor-fails-to-restart-half-of-the-time

It can be fixed by rewriting the restart handler this way:

- name: stop supervisor
  service:
    name: supervisor
    state: stopped
  listen: "restart supervisor"

- name: waiting for supervisor to be stopped
  wait_for:
    path: /var/run/supervisord.pid
    state: absent
    sleep: 5
  listen: "restart supervisor"

- shell: ps faux | grep supervisor

- name: start supervisor
  service:
    name: supervisor
    state: started
  listen: "restart supervisor"

Edit: the proposal above does not work as expected yet. I'll edit it when I can confirm it works.

Another solution might be to call service supervisor restart using the Ansible shell module.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions