clr

2025-10-24T14:48:33.312579Z

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

👀 1
dmiller 2025-10-24T23:11:14.266669Z

that looks like fun to debug.

2025-10-24T23:36:03.318739Z

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: 

2025-10-24T23:44:03.381399Z

Also if there's any parallelism at all. I couldn't find any.

2025-10-24T23:56:38.530919Z

But there must be some, because ensure-git-dir checks if it's already cloned.

2025-10-25T00:08:24.298669Z

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.

2025-10-25T00:15:48.765289Z

> @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.

dmiller 2025-10-25T02:04:21.029289Z

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.

👍 1