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

Add timeout and retry logic for finding NGINX PID file #676

Merged
merged 3 commits into from
Jun 12, 2023

Conversation

ciarams87
Copy link
Member

@ciarams87 ciarams87 commented May 24, 2023

Proposed changes

Occasionally, the Gateway container starts before the NGINX container, and this means we may attempt a reload of NGINX before the NGINX process exists. This commit checks if the PID file exists with timeout and retry logic to give the NGINX container time to start.

Closes #600

Checklist

Before creating a PR, run through this checklist and mark each as complete.

  • I have read the CONTRIBUTING doc
  • I have added tests that prove my fix is effective or that my feature works
  • I have checked that all unit tests pass after adding my changes
  • I have updated necessary documentation
  • I have rebased my branch onto main
  • I will ensure my PR is targeting the main branch and pulling from my branch from my own fork

@ciarams87 ciarams87 requested a review from a team as a code owner May 24, 2023 13:24
@github-actions github-actions bot added the bug Something isn't working label May 24, 2023
@ciarams87 ciarams87 force-pushed the fix/dont-return-error-fnf branch 2 times, most recently from 9231da3 to 5219023 Compare June 8, 2023 14:00
@ciarams87 ciarams87 changed the title Don't return an error on reload when NGINX PID file not found Add timeout and retry logic for finding NGINX PID file Jun 8, 2023
@ciarams87 ciarams87 force-pushed the fix/dont-return-error-fnf branch 2 times, most recently from a9c6d3d to 3087bd4 Compare June 8, 2023 18:10
internal/nginx/runtime/manager.go Outdated Show resolved Hide resolved
internal/nginx/runtime/manager.go Outdated Show resolved Hide resolved
Copy link
Contributor

@pleshakov pleshakov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a few suggestions based on the new code. otherwise, looks good!

internal/nginx/runtime/manager_test.go Outdated Show resolved Hide resolved
internal/nginx/runtime/manager_test.go Show resolved Hide resolved
internal/nginx/runtime/manager.go Outdated Show resolved Hide resolved
Copy link
Contributor

@pleshakov pleshakov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@ciarams87 ciarams87 merged commit b9a6684 into nginxinc:main Jun 12, 2023
13 checks passed
@ciarams87 ciarams87 deleted the fix/dont-return-error-fnf branch June 12, 2023 21:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

NGINX reload fails with "failed to find NGINX main process"
3 participants