Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent failed post-stop script task from stopping Upstart respawning #765

Merged
merged 4 commits into from
Mar 26, 2019

Conversation

rmartz
Copy link
Contributor

@rmartz rmartz commented Mar 22, 2019

Overview

After one of our Docker processes ends, we configure Upstart to kill the container and delete it. However, because the process has ended, the command Upstart is configured to kill the container fails:

Error response from daemon: Cannot kill container driver-gradle: Container 6c9afdbe941ae917002f069761f1584d0093ac420f330333a364241a9c9a5d28 is not running

This failed docker kill command would cause Upstart to abort the process respawn, leaving the service stopped.

It's not clear if docker kill is needed in the post-stop script section, but in order to prevent a failure from stopping Upstart from attempting to respawn the process this appends || true to each command so that they will be respawned even if one of the post-stop commands fails.

Checklist

  • PR has a descriptive enough title to be useful in changelogs

Testing Instructions

  • vagrant provision celery
  • Open a terminal and SSH into the celery server
  • sudo tail -f /var/log/upstart/driver-gradle.log
  • Open a second terminal and SSH into the database server
  • sudo service redis-server stop
    • You should see messages in the celery SSH terminal showing the Gradle process being repeatedly respawned and failing
  • sudo service redis-server start
    • You should see the messages stop and diagnostic messages showing the process is waiting for messages
  • Exit the database server
  • vagrant reload database
    • You should see messages in the celery SSH terminal showing the Gradle process being respawned, and recover when the database server has finished reloading

Closes #164140129

@rmartz rmartz requested review from kshepard and pcaisse and removed request for kshepard March 22, 2019 19:57
@rmartz rmartz assigned pcaisse and unassigned kshepard Mar 22, 2019
@rmartz
Copy link
Contributor Author

rmartz commented Mar 25, 2019

Just pushed a commit that should fix provisioning the Celery server not restarting the Gradle server and leaving it running an old version of the code.

@rmartz rmartz merged commit 202c5c7 into develop Mar 26, 2019
@rmartz rmartz deleted the feature/gradle-hangs branch March 26, 2019 16:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants