mogge
Morning! I ended up with Alex and Ghadi and Fogus and Rich himself all involved with the core.async / vthreads thing yesterday! 🙂 And it does seem like fixing the memory leak will require changes to core.async (due to a weird impl. detail in the JVM about how vthreads are created and tracked in different contexts). Plus a JVM property needs to be set 😞
what was the fix for the idrop thing? ... how do you drop a fractional number of elements from a seq??
Well, that always used to work and "did the right thing" -- and our code accidentally relied on that working -- so the fix was to add a coercion, I think. It was this issue: https://clojure.atlassian.net/browse/CLJ-2772
interesting - how did that manifest as a memory leak? (I'm often fascinated by debugging war stories)
I think it ended up dropping zero items instead of at least one, which caused a loop that accumulated data instead of consuming data... It only affected one app, and that it manifested as a memory leak was confusing initially... that's why it took us a while to track the problem down. Tests didn't generate enough data (and not all production requests did either).
The bug was introduced in 1.12 alpha 1, although it was alpha 2 that we went to production with, and fixed in alpha 6:
(!1998)-> clojure -Sdeps '{:deps {org.clojure/clojure {:mvn/version "1.12.0-alpha1"}}}'
Downloading: org/clojure/clojure/1.12.0-alpha1/clojure-1.12.0-alpha1.pom from central
Downloading: org/clojure/clojure/1.12.0-alpha1/clojure-1.12.0-alpha1.jar from central
Clojure 1.12.0-alpha1
user=> (drop (/ 3 4) [1 2 3])
(1 2 3)
user=>
(2025-10-28.10:24:12)-(~/clojure)
(!1999)-> clojure -Sdeps '{:deps {org.clojure/clojure {:mvn/version "1.11.4"}}}'
Clojure 1.11.4
user=> (drop (/ 3 4) [1 2 3])
(2 3)
user=>
(2025-10-28.10:24:36)-(~/clojure)
(!2000)-> clojure -Sdeps '{:deps {org.clojure/clojure {:mvn/version "1.12.0-alpha6"}}}'
Downloading: org/clojure/clojure/1.12.0-alpha6/clojure-1.12.0-alpha6.pom from central
Downloading: org/clojure/clojure/1.12.0-alpha6/clojure-1.12.0-alpha6.jar from central
Clojure 1.12.0-alpha6
user=> (drop (/ 3 4) [1 2 3])
(2 3)Cool ... thanks for taking the time to explain the details. Good catch 😉
in a quid pro quo (Clarice) this is one of my favourite debugging stories https://www.ibiblio.org/harris/500milemail.html ... stop me if you've heard this one 😉
Hahaha... that's awesome!
dang... that is quite some achievements!
This is the second time I've run into a gnarly memory leak bug with Clojure and ended up spending a bunch of time debugging it with Alex. That previous time was the IDrop optimization that broke drop calls with fractional n -- such a weird cause! -- and it only happened on one of our apps. Alex and I sat in the hotel lobby at Conj for a couple of hours going over heap dumps! 🙂