There might be a race condition in the dependency resolution algorithm of cljr. I put symptoms here, I'll try and investigate later: https://github.com/clojure/clr.core.cli/issues/4
that looks like fun to debug.
Looking at the code, any problem involving cloning this repo could have caused this error, including firewall issues. The main thing I'm curious about at this point is whether this kind of output is expected (you'd hope each repo would be cloned only once):
Cloning:
Cloning:
Also if there's any parallelism at all. I couldn't find any.
But there must be some, because ensure-git-dir checks if it's already cloned.
It just happened again, I'll see if I can get copilot to debug it for me by intercepting git calls and seeing if any overlap or start with unexpected file system state.
> @copilot please concentrate on reproducing and describing the race condition in ./script/test-clr. I can't reproduce your results but it's happened several times in a copilot session (reported here ht...
*Race Condition Confirmed and Analyzed*
Created git wrapper at /tmp/git and successfully reproduced the race. Here's what's happening:
*Evidence from logs:*
[2025-10-25 00:11:31.699927462] [PID:4571] git clone --quiet --mirror /home/runner/.gitlibs/_repos/https/github.com/clojure/clr.tools.reader
[2025-10-25 00:11:31.699925786] [PID:4572] git clone --quiet --mirror /home/runner/.gitlibs/_repos/https/github.com/clojure/clr.tools.reader
[2025-10-25 00:11:31.699927462] [PID:4571] Target does not exist
[2025-10-25 00:11:31.699925786] [PID:4572] Target does not exist
*Root cause confirmed: Two threads (PID 4571 and 4572) are invoked simultaneously* (same microsecond timestamp) to clone clr.tools.reader.git. Both check (.Exists config-file) and find it doesn't exist, then both attempt to clone.
*Result:* PID 4571 succeeds (exit 0), PID 4572 fails with "fatal: destination path already exists" (exit 128).
*Your conjecture is correct:* The race is in ensure-git-dir. Two threads pass the (.Exists config-file) check simultaneously before either completes the clone.
*Fix needed:* Add locking/synchronization in ensure-git-dir before the existence check, or use atomic directory creation to claim ownership before cloning.Nice. This code is a fairly straightforward port of the ClojureJVM code. Mostly just IO changes, and the process start code. I don't see any synchronization in there, so I'm wondering if there is something in the base libraries that prevent it. This is cross-process, not cross-thread in-process, so locking/synchro will take a little more work. I'll get on it. Thanks for the tracking it down. Saved me tons of time.