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

bug: portion of the file is locked #1144

Closed
githubcdr opened this issue Sep 23, 2024 · 8 comments · Fixed by #1146
Closed

bug: portion of the file is locked #1144

githubcdr opened this issue Sep 23, 2024 · 8 comments · Fixed by #1146
Labels
bug Something isn't working

Comments

@githubcdr
Copy link

Describe the issue

kubelogin does not seem to work after upgrading to 1.30.0

error: get-token: could not write the token cache: json encode error: write C:\Users.....e\oidc-login\f47b8beecda810bf915550407dd07d603106a87cb9c80a227d0c935ee5ad0c38: The process cannot access the file because another process has locked a portion of the file.

Deleting the file did not solve this

To reproduce

update to version 1.30.0, try to login

Your environment

  • OS: Win11
  • kubelogin version: e.g. v1.30
  • kubectl version: e.g. v1.31.0
  • OpenID Connect provider: custom
@githubcdr githubcdr added the bug Something isn't working label Sep 23, 2024
@TobiKattmann
Copy link

TobiKattmann commented Sep 23, 2024

I have exactly the same problem with kubelogin 1.30.0 and reverting to 1.29.0 is a temporary workaround for me (i.e. 1.29.0 from the releases works) 👍

PS <user>> kubectl get nodes
error: get-token: could not write the token cache: json encode error: write C:\Users\<user>\.kube\cache\oidc-login\02e4d5d5d03a8d8ad9f22f2be05cdbca8ee82bd473efca0fd197580bac823c06: The process cannot access the file because another process has locked a portion of the file.
Error: exit status 1

For what it is worth I am also on Win11.

@githubcdr
Copy link
Author

kubectl-oidc_login.exe get-token --oidc-issuer-url=https://om.......rl/oidc --oidc-client-id=native --oidc-extra-scope=cluster:silnet -v 99 --token-cache-dir D:\

I0923 13:43:40.996959   12784 get_token.go:127] you got a valid token until 2024-09-24 01:48:40 +0200 CEST
I0923 13:43:40.997468   12784 get_token.go:73] releasing the lock of token cache
error: get-token: could not write the token cache: json encode error: write D:\f47b8beecda810bf915550407dd07d603106a87cb9c80a227d0c935ee5ad0c38: The process cannot access the file because another process has locked a portion of the file.
I0923 13:43:40.997468   12784 cmd.go:76] stacktrace: get-token: could not write the token cache: json encode error: write D:\f47b8beecda810bf915550407dd07d603106a87cb9c80a227d0c935ee5ad0c38: The process cannot access the file because another process has locked a portion of the
file.

@a-hulman
Copy link

I confirm, kubelogin will fail to write/read the cache with my Windows 11 in current version(1.30). Also fixed with downgrading to 1.29.

@int128
Copy link
Owner

int128 commented Sep 24, 2024

Since 1.30 (#1126), it locks the cache file using https://github.com/gofrs/flock. Not working expectedly on Windows?

@int128
Copy link
Owner

int128 commented Sep 24, 2024

I could reproduce this issue in CI as #1146. I will try to fix it.

@int128
Copy link
Owner

int128 commented Sep 24, 2024

Thank you for bringing up the issue. Could you try the new release?
https://github.com/int128/kubelogin/releases/tag/v1.30.1

@jynolen
Copy link

jynolen commented Sep 24, 2024

I confirmed it fixed the issue on my side

@TobiKattmann
Copy link

Big thanks @int128 -> v1.30.1 fixes the issue for me!
💐 Take this as a token of appreciation for you super fast response and solution, very much appreciated :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants