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

client: defer nobody user lookup so Windows doesn't panic #14790

Merged
merged 3 commits into from
Oct 4, 2022

Conversation

tgross
Copy link
Member

@tgross tgross commented Oct 4, 2022

In #14742 we introduced a cached lookup of the nobody user, which is only ever called on Unixish machines. But the initial caching was being done in an init block, which meant it was being run on Windows as well. This prevents the Nomad agent from starting on Windows.

An alternative fix here would be to have a separate init block for Windows and Unix, but this potentially masks incorrect behavior if we accidentally added a call to the Nobody() method on Windows later. This way we're forced to handle the error in the caller.


Before:

C:\opt> C:\opt\nomad.exe agent -config C:\etc\nomad.d"
panic: unable to lookup the nobody user: No mapping between account names and security IDs was done.

goroutine 1 [running]:
github.com/hashicorp/nomad/helper/users.init.0()
        github.com/hashicorp/nomad/helper/users/lookup.go:28 +0xfd

After:

C:\opt> C:\opt\nomad.exe agent -config C:\etc\nomad.d
==> Loaded configuration from C:\etc\nomad.d\base.hcl, C:\etc\nomad.d\client-windows-0.hcl, C:\etc\no
mad.d\client-windows.hcl, C:\etc\nomad.d\consul.hcl, C:\etc\nomad.d\tls.hcl, C:\etc\nomad.d\vault.hcl
==> Starting Nomad agent...
...

In #14742 we introduced a cached lookup of the `nobody` user, which is only ever
called on Unixish machines. But the initial caching was being done in an `init`
block, which meant it was being run on Windows as well. This prevents the Nomad
agent from starting on Windows.

An alternative fix here would be to have a separate `init` block for Windows and
Unix, but this potentially masks incorrect behavior if we accidentally added a
call to the `Nobody()` method on Windows later. This way we're forced to handle
the error in the caller.
@github-actions
Copy link

github-actions bot commented Feb 3, 2023

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 Feb 3, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants