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

executor: fail early on reattach if listener is not executor #24538

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

mismithhisler
Copy link
Member

@mismithhisler mismithhisler commented Nov 22, 2024

Description

Fixes a bug reported by Windows users where Nomad was killing random processes on reboot. This was due to the reattach config containing a PID and RPC address that was now occupied by other processes/listeners. When Nomad would attempt to make an RPC, it would fail, and kill the process. With this change, we fail early on reattach, and do not kill the process.

Testing & Reproduction steps

Reproduction involves simulating this scenario via overriding the reattach PID when starting a task to a known PID (another bash session), rebooting Nomad, killing the executor process, and listening on the reattach address.

Links

Fixes GH #23969

Contributor Checklist

  • Changelog Entry If this PR changes user-facing behavior, please generate and add a
    changelog entry using the make cl command.
  • Testing Please add tests to cover any new functionality or to demonstrate bug fixes and
    ensure regressions will be caught.
  • Documentation If the change impacts user-facing functionality such as the CLI, API, UI,
    and job configuration, please update the Nomad website documentation to reflect this. Refer to
    the website README for docs guidelines. Please also consider whether the
    change requires notes within the upgrade guide.

Reviewer Checklist

  • Backport Labels Please add the correct backport labels as described by the internal
    backporting document.
  • Commit Type Ensure the correct merge method is selected which should be "squash and merge"
    in the majority of situations. The main exceptions are long-lived feature branches or merges where
    history should be preserved.
  • Enterprise PRs If this is an enterprise only PR, please add any required changelog entry
    within the public repository.

@mismithhisler mismithhisler requested review from a team as code owners November 22, 2024 13:32
@mismithhisler mismithhisler added backport/ent/1.7.x+ent Changes are backported to 1.7.x+ent backport/ent/1.8.x+ent Changes are backported to 1.8.x+ent backport/1.9.x backport to 1.9.x release line labels Nov 22, 2024
Copy link
Member

@tgross tgross left a comment

Choose a reason for hiding this comment

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

LGTM! Nice work on this!

Comment on lines 78 to 81
// ReattachToExecutor launches a plugin with a given plugin config and validates it can call the executor.
// On Windows, go-plugin listens on a localhost port. It is possible on a reboot that another process is
// listening on that port, and a process is running with the previous executors PID, leading Nomad to kill
// "random" processes. Fail early via the Version RPC if we detect the listener isn't actually an Executor.
Copy link
Member

Choose a reason for hiding this comment

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

Great addition to the comment. Were you able to to track down where the kill was being emitted downstream? It might be nice to mention that here, as I know both of us spent a good bit of time trying to find it.

Copy link
Member Author

Choose a reason for hiding this comment

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

In my reproduction I noticed the downstream call happening here in the taskRunner after a failed RPC happened. I will update the comment to add this context.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport/ent/1.7.x+ent Changes are backported to 1.7.x+ent backport/ent/1.8.x+ent Changes are backported to 1.8.x+ent backport/1.9.x backport to 1.9.x release line
Projects
None yet
Development

Successfully merging this pull request may close these issues.

process not managed by Nomad killed on restart
2 participants