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

Error writing config: rename ~/.cf/temp-config929711920 ~/.cf/config.json: no such file or directory #2232

Closed
4 tasks done
ryenus opened this issue Nov 17, 2021 · 10 comments · Fixed by #2937
Closed
4 tasks done

Comments

@ryenus
Copy link

ryenus commented Nov 17, 2021

Please fill out the issue checklist below and provide ALL the requested information.

  • I reviewed open and closed github issues that may be related to my problem.
  • I tried updating to the latest version of the CF CLI to see if it fixed my problem.
  • I attempted to run the command with CF_TRACE=1 to help debug the issue.
  • I am reporting a bug that others will be able to reproduce.

Describe the bug and the command you saw an issue with
Provide details on what you were trying to do (and why).

What happened
When I was using GNU parallel to run some scripts that can execute multiple cf commands in parallel, I got the below error for one job, but others worked:

Error writing config: rename /Users/user/.cf/temp-config929711920 /Users/user/.cf/config.json: no such file or directory

I compared the config.json file and found that only the AccessToken field was different when that file was changed. And after inspecting the AccessToken, especially the iat and exp fields, where the latter is only 1-hour after the former.

And thanks to #1594, the token must have been automatically refreshed when my script was running. So more then one cf commands tried to refresh the token and it caused contentions even they try to use temp files.

Expected behavior
Whether there's an even smarter way to avoid parallel file writing contention, I would expect the life span of the CF CLI access token can be extended to something like 1 day, or at least 12 hours.

The default 1-hour life span of the CF access token is really just too short, especially when one needs to work with multiple CF spaces, BTW I also use $CF_HOME to work with multiple CF spaces simultaneously.

Exact Steps To Reproduce
Steps to reproduce the behavior; include the exact CLI commands and verbose output:

  1. Run cf login, to a space where multiple apps or services are deployed
  2. Take the AccessToken field in $CF_HOME/.cf/config.json
  3. Use a JWT decoder to inspect the above AccessToken, check the exp field
  4. Convert the value of the exp field to a readable date, e.g. using date -d@1636967840
  5. At the time when the token is about to expire, launch some command that uses GNU parallel to run multiple cf commands concurrently, e.g., cf apps | awk 'NR>4 {print $1}' | parallel -N1 cf env

Provide more context

  • platform and shell details: Mac OS 12.0.1, iTerm 3.4.12, Bash 5.1.8 installed via Homebrew
  • version of the CLI you are running: cf version 8.0.0+e8d41cf8e.2021-09-16
  • version of the CC API Release you are on: 3.108.0"

Notes regarding V6 and V7 CLI support:

  • V6:
    • Minimum supported version of CF Deployment: v7.0.0 (CAPI Release: 1.74.0 (APIs 2.128.0 and 3.63.0))
    • Maximum supported version of CF Deployment: v13.4.0 (CAPI Release: 1.94.0 (APIs 2.149.0 and 3.84.0))
  • V7:
    • Minimum supported version of CF Deployment: v13.5.0 (CAPI Release: 1.95.0 (APIs 2.150.0 and 3.85.0))
@hebelal
Copy link

hebelal commented Nov 15, 2022

Experiencing the same issue when running multiple cf commands in parallel.

@DanieleStrafile
Copy link

experiencing the same issue as well!

@joergmann
Copy link

same here

@LotharBender
Copy link

LotharBender commented May 14, 2024

Experiencing the same issue when running multiple cf commands in parallel.

@LotharBender
Copy link

LotharBender commented May 22, 2024

Thank you @gururajsh. When will the new version of the CF CLI 8 be available?

@ryenus
Copy link
Author

ryenus commented May 22, 2024

Wow, happy to see this is now fixed! Thank you @gururajsh and thanks to all of you for your support!

@LotharBender
Copy link

LotharBender commented Jun 3, 2024

Hi @gururajsh,
it seems that there is still no patch available. Do you know when a patch of the v8 CLI installer will be released?
Just checked I still get version 8.7.10+5b7ce3c.2024-04-04

Thanks!

@gururajsh
Copy link
Member

Hi @LotharBender ,

We are in the middle of modifying release process for CLI. Once that is complete, we'll be creating a release. Hoping to complete it in a week or two.

@rlindner81
Copy link

This issue hit our project as well...

@gururajsh
Copy link
Member

Hello.. New CLI version is released with this fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants