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

Fix nginx-agent shutdown #44

Merged
merged 3 commits into from
Sep 21, 2022
Merged

Fix nginx-agent shutdown #44

merged 3 commits into from
Sep 21, 2022

Conversation

Dean-Coakley
Copy link
Contributor

@Dean-Coakley Dean-Coakley commented Sep 16, 2022

Bug

The ProcessWatcher waitgroup was already decremented in it's goroutine so the wg.Done() in plugin.Close() led to panic due to negative waitgroup counter.

...
INFO[0001] ProcessWatcher is wrapping up
panic: sync: negative WaitGroup counter
...
go/src/github.com/nginx/agent/main.go:93 +0x53

This means on SIGTERM/SIGINT the main nginx-agent process would exit with status code 2 which is reported in systemd status.

Proposed changes

  • Remove duplicate waitgroup decrement

Checklist

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

  • I have read the CONTRIBUTING document
  • If applicable, I have added tests that prove my fix is effective or that my feature works
  • If applicable, I have checked that any relevant tests pass after adding my changes
  • I have updated any relevant documentation (README.md)

ProcessWatcher waitgroup was already decremented in it's go routine so
the wg.Done() in plugin.Close() led to panic due to negative waitgroup.

This means on SIGTERM/SIGINT the main nginx-agent process would exit
with status code 2 which is reported in systemd status.
@Dean-Coakley Dean-Coakley self-assigned this Sep 16, 2022
@github-actions github-actions bot added the bug Something isn't working label Sep 16, 2022
@dhurley
Copy link
Collaborator

dhurley commented Sep 21, 2022

@Dean-Coakley Can you run make deps before merging this PR?

@Dean-Coakley Dean-Coakley merged commit d4dca2d into main Sep 21, 2022
@Dean-Coakley Dean-Coakley deleted the fix-agent-shutdown branch September 21, 2022 09: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 dependencies
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants