Skip to content

Conversation

@drichardson
Copy link
Contributor

@drichardson drichardson commented Jun 21, 2025

There is a race condition when doppler CLI is run concurrently.

This PR creates/checks existence of files in one syscall (mkdir) to avoid this race condition for the configuration (~/.doppler) and fallback (~/.doppler/fallback) directories.

Closes #493

Repeated test in #493 with this change and could no longer reproduce the race condition.

Atomically create and check directories.
@drichardson drichardson requested a review from a team as a code owner June 21, 2025 02:29
@nmanoogian
Copy link
Contributor

Thank you for investigating this and putting up a fix! Your changes look good and do indeed fix the issue in my testing.

Looking at your report, I suspect that there might be other race-condition-related bugs in concurrent runs of commands that modify the config file (doppler setup and doppler login) -- we might need to consider some kind of file-based locking to resolve those completely. However, I think the directory creation is going to be one of the largest areas of concern, especially in CI where lots of scripting/concurrency is happening. Moreover, your fix isn't likely to obscure any of those config-related race conditions, which could still happen today anyway (without your fix) if the directories are already in place.

Two quick asks:

  • For better or worse, our commit messages are automatically turned into release notes during our deploys. You can include additional information in the commit body but can you revise your commit message to something like this?
    • "Fix race condition in concurrent creation of config and fallback dirs"
  • It looks like we have an e2e test failing here. These can be irritating to pin down with our testing harness so I'll look into this and get back to you with a fix unless you beat me to it

@drichardson
Copy link
Contributor Author

Yeah I can fix the commit message. I'm on vacay rn and didn't bring my computer with me so will be a couple weeks.

Or feel free to rewrite my commit message, or just throw this PR in the trash and fix it elsewhere.

@nmanoogian
Copy link
Contributor

Sounds good! I'll push your changes back up onto an internal branch. I'd typically prefer that we do it through an external PR so you can get attribution but I think that E2E test is also failing because of a secrets access issue related to the PR being external.

@nmanoogian
Copy link
Contributor

Closing in favor of #495

@nmanoogian nmanoogian closed this Jun 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Race condition when running doppler concurrently on CI "Unable to create config directory"

2 participants