It seems gitlibs isn't thread-safe or inter-process safe by default. Should users protect themselves from this by using a lock and an inter-process lock perhaps or should this be fixed in gitlibs? Both fine with me, just wanted to know your take. https://clojurians.slack.com/archives/CLX41ASCS/p1758702433439109?thread_ts=1758659908.026909&cid=CLX41ASCS
Similar repro with Clojure only:
It’s on my infinite list of things to look at
Lock files have their own problems of course, especially on windows
I've been doing a similar thing for clj-kondo .cache which uses both ReentrantLock and FileChannel + tryLock
what are the caveats on windows?
I vaguely recall interprocess issues with file deleting
Been a long while though so maybe that’s just my own FUD
It's not urgent from my side and I don't even know if it was the cause of the issue mentioned in the link, but I could reproduce something like it. Still finding out the issue in the original thread. Can't reproduce it myself.
tools.deps itself does parallel downloads / installs. There’s a lot more protection now internally to avoid stepping on itself but it’s not perfect
I guess you can't have one git lib with two different shas in one dep tree though (which is what @richiardiandrea has)
unless you name the lib differently maybe?
Well, yeah. Same as not having two versions of the same maven lib
I could definitely see that stepping on each other
not sure if that is the issue, can't repro that with:
(require '[clojure.repl.deps :as deps])
(deps/add-libs '{com.grzm/awyeah-api {:git/sha "e5513349a2fd8a980a62bbe0d45a0d55bfcea141"
:git/url ""}
com.grzm/awyeah-api2 {:git/sha "9257dc0159640e46803d69210cae838d411f1789"
:git/url ""}}) I can't repro it using this test so it's likely not that issue:
(require '[babashka.deps :as deps])
(deps/add-deps {:deps (zipmap (repeatedly 100 #(symbol (str (gensym "foo")) (str (gensym "bar"))))
(repeatedly 100 #(do {:git/sha (rand-nth ["e5513349a2fd8a980a62bbe0d45a0d55bfcea141"
"404ba1ae85e18d654aee813a75500515319fcd15"
"d98a9f6210c61d64f22e9b577d2254d6f6d2f35f"])
:git/url ""})))}) In the coursier code i cloned for jresolve there is an interprocess file lock - i think it works around the windows issues
if that helps at all
I use a similar approach except that I don't delete the lock file
Noticed a thing: the https://repo1.maven.org/maven2/org/clojure/tools.deps.cli/0.12.110/tools.deps.cli-0.12.110.pom> points back to the wrong github repo:
scm:git:git@github.com:clojure/tools.deps.alpha.git
scm:git:git@github.com:clojure/tools.deps.alpha.git
git@github.com:clojure/tools.deps.alpha.git
v0.12.110
Should be pointing to https://github.com/clojure/tools.deps.cli, no? Impact: services like clojars and cljdoc won't be able to link back to sources.
I can repost to http://ask.clojure.org, if that's helpful.thx, I'll fix, that's the original scm. not published to clojars so doesn't matter there
Oh right, good point about clojars (doh), cljdoc takes a peek though.
fixed