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

Backport of Fix server shutdown not waiting for worker run completion into release/1.5.x #19637

Conversation

hc-github-team-nomad-core
Copy link
Contributor

Backport

This PR is auto-generated from #19560 to be assessed for backporting due to the inclusion of the label backport/1.5.x.

🚨

Warning automatic cherry-pick of commits failed. If the first commit failed,
you will see a blank no-op commit below. If at least one commit succeeded, you
will see the cherry-picked commits up to, not including, the commit where
the merge conflict occurred.

The person who merged in the original PR is:
@shoenig
This person should manually cherry-pick the original PR into a new backport PR,
and close this one when the manual backport PR is merged in.

merge conflict error: POST https://api.github.com/repos/hashicorp/nomad/merges: 409 Merge conflict []

The below text is copied from the body of the original PR.


Fixes #19556.

I'm not too sure how/where to add tests for this - please feel free to let me know and I'm happy to add the tests! For now, I've manually tested it following the repro listed in the issue and it seems to work as intended.


Overview of commits

@hashicorp-cla
Copy link

hashicorp-cla commented Jan 5, 2024

CLA assistant check
All committers have signed the CLA.

Fix server shutdown not waiting for worker run completion (#19560)

* Move group into a separate helper module for reuse

* Add shutdownCh to worker

The shutdown channel is used to signal that worker has stopped.

* Make server shutdown block on workers' shutdownCh

* Fix waiting for eval broker state change blocking indefinitely

There was a race condition in the GenericNotifier between the
Run and WaitForChange functions, where WaitForChange blocks
trying to write to a full unsubscribeCh, but the Run function never
reads from the unsubscribeCh as it has already stopped.

This commit fixes it by unblocking if the notifier has been stopped.

* Bound the amount of time server shutdown waits on worker completion

* Fix lostcancel linter error

* Fix worker test using unexpected worker constructor

* Add changelog

---------

Co-authored-by: Marvin Chin <[email protected]>
@shoenig shoenig force-pushed the backport/fix-server-shutdown-not-waiting-for-worker-run-completion/vertically-summary-bunny branch from 1889809 to 2bb6220 Compare January 5, 2024 16:48
@shoenig shoenig marked this pull request as ready for review January 5, 2024 17:20
@shoenig shoenig merged commit 375d75b into release/1.5.x Jan 5, 2024
23 of 25 checks passed
@shoenig shoenig deleted the backport/fix-server-shutdown-not-waiting-for-worker-run-completion/vertically-summary-bunny branch January 5, 2024 17:21
Copy link

I'm going to lock this pull request because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active contributions.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 25, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants