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

Support custom cache dir #8

Closed
wants to merge 1 commit into from
Closed

Support custom cache dir #8

wants to merge 1 commit into from

Conversation

mrkam2
Copy link

@mrkam2 mrkam2 commented Feb 8, 2024

In our CI we want to run several clojure tasks for the same project in parallel and they sometimes fail with:

Refreshing classpath
Error building classpath. Can't create directory: /path/to/project/.cpcache

due to a race condition. I'm proposing this change to make the cache configurable.

Thoughts?

In our CI we want to run several clojure tasks for the same project in parallel and they sometimes fail with:

```
Refreshing classpath
Error building classpath. Can't create directory: /path/to/project/.cpcache
```

due to a race condition. I'm proposing this change to make the cache configurable.
@mrkam2
Copy link
Author

mrkam2 commented Feb 9, 2024

I believe race condition is happening in https://github.com/clojure/tools.deps/blob/master/src/main/clojure/clojure/tools/deps/util/io.clj#L53-56

When parent doesn't exist, it proceeds to the .mkdir. But if directories already exist by the time .mkdir creates them, it returns false.

Alternatively we could be checking if the directory exists again after .mkdir returned false as in https://github.com/clojure/tools.deps.alpha/pull/3/files#diff-9d69f30572d7d2f8b1b5b4216257178933c0d73ef285ae66bc97ae5acdab59cfR53-R57

@puredanger
Copy link
Member

Hi, this project doesn't support pull requests so I'm going to close the PR, but please go to https://ask.clojure.org/index.php/13671/race-condition-in-cpcache-directory-creation to vote for this issue or provide info there. I do believe your assessment as to the source of the problem is correct, probably more likely that we will try to address it in the script than add more config.

@puredanger puredanger closed this Mar 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants