Open LHCGreg opened 3 years ago
@mtrmac looks like we need to lock the auth.json file while we are updating it.
Yeah, ioutil.WriteFile
is not atomic (it’s O_TRUNC
of the existing file + write). At least being atomic so that clients don’t see empty/partial files definitely makes sense; truly locking so that we don’t lose data on concurrent writes might be harder.
As of #1515 concurrent logins should not corrupt the file, but it’s possible that some of the concurrent updates will be lost.
So, if there are multiple podman login
attempts with the same credentials for the same scope, it doesn’t matter which one wins and the credentials will be available; but with concurrent logins for different scopes, some of the login commands might succeed but data would not, ultimately, be available in auth.json
.
See #1506 for implementation discussion about locking that could fix the multiple-scope issue.
Is this a BUG REPORT or FEATURE REQUEST? (leave only one on its own line)
/kind bug
Description
If multiple
podman login
commands are executed simultaneously, you can get the errorSteps to reproduce the issue:
Describe the results you received:
Out of three login commands, 2 logins succeeded, and one got the error
Describe the results you expected: I expected multiple simultaneous logins to work, with one of them ultimately "winning" and having its login info in wherever it gets stored.
Additional information you deem important (e.g. issue happens only occasionally): This isn't a big deal for me. I can change our code so it only issues one login command. I just figured I'd file an issue.
Output of
podman version
:Output of
podman info --debug
:Package info (e.g. output of
rpm -q podman
orapt list podman
):Have you tested with the latest version of Podman and have you checked the Podman Troubleshooting Guide? (https://github.com/containers/podman/blob/master/troubleshooting.md)
Yes
Additional environment details (AWS, VirtualBox, physical, etc.): Running podman inside another container in kubernetes.