tools-deps

borkdude 2025-09-24T08:28:29.613699Z

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

borkdude 2025-09-24T08:41:05.621229Z

Similar repro with Clojure only:

Alex Miller (Clojure team) 2025-09-24T13:01:58.992809Z

It’s on my infinite list of things to look at

Alex Miller (Clojure team) 2025-09-24T13:02:51.018649Z

Lock files have their own problems of course, especially on windows

borkdude 2025-09-24T13:05:10.957549Z

I've been doing a similar thing for clj-kondo .cache which uses both ReentrantLock and FileChannel + tryLock

borkdude 2025-09-24T13:05:27.519519Z

what are the caveats on windows?

Alex Miller (Clojure team) 2025-09-24T13:06:37.167049Z

I vaguely recall interprocess issues with file deleting

Alex Miller (Clojure team) 2025-09-24T13:07:12.292669Z

Been a long while though so maybe that’s just my own FUD

borkdude 2025-09-24T13:35:54.182559Z

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.

Alex Miller (Clojure team) 2025-09-24T13:46:44.809189Z

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

borkdude 2025-09-24T13:47:44.833469Z

I guess you can't have one git lib with two different shas in one dep tree though (which is what @richiardiandrea has)

borkdude 2025-09-24T13:48:17.439129Z

unless you name the lib differently maybe?

Alex Miller (Clojure team) 2025-09-24T13:48:30.383849Z

Well, yeah. Same as not having two versions of the same maven lib

Alex Miller (Clojure team) 2025-09-24T13:49:22.810649Z

I could definitely see that stepping on each other

👍 1
borkdude 2025-09-24T13:51:04.585409Z

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 ""}})

borkdude 2025-09-24T13:51:20.975219Z

could be though. cc @richiardiandrea

👍 1
borkdude 2025-09-24T14:12:48.451759Z

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 ""})))})

emccue 2025-09-24T14:59:35.734339Z

In the coursier code i cloned for jresolve there is an interprocess file lock - i think it works around the windows issues

emccue 2025-09-24T15:00:13.579099Z

https://github.com/bowbahdoe/jresolve/issues/5

emccue 2025-09-24T15:03:28.735789Z

if that helps at all

borkdude 2025-09-24T15:24:27.089089Z

I use a similar approach except that I don't delete the lock file

lread 2025-09-24T02:37:37.133429Z

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.

Alex Miller (Clojure team) 2025-09-24T02:42:25.610539Z

thx, I'll fix, that's the original scm. not published to clojars so doesn't matter there

👍 1
lread 2025-09-24T02:45:33.802809Z

Oh right, good point about clojars (doh), cljdoc takes a peek though.

Alex Miller (Clojure team) 2025-09-24T02:47:36.818009Z

fixed

🎉 3