clojure-uk

thomas 2025-10-23T09:43:29.988689Z

mogge

seancorfield 2025-10-23T13:36:29.404029Z

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 😞

Ed 2025-10-28T10:30:54.242399Z

what was the fix for the idrop thing? ... how do you drop a fractional number of elements from a seq??

seancorfield 2025-10-28T13:13:31.954669Z

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

Ed 2025-10-28T14:00:33.860279Z

interesting - how did that manifest as a memory leak? (I'm often fascinated by debugging war stories)

seancorfield 2025-10-28T14:19:15.180019Z

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

👍 1
seancorfield 2025-10-28T14:25:28.233959Z

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)

Ed 2025-10-28T14:35:25.244259Z

Cool ... thanks for taking the time to explain the details. Good catch 😉

Ed 2025-10-28T14:38:09.787519Z

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 😉

seancorfield 2025-10-28T14:41:58.792929Z

Hahaha... that's awesome!

😁 1
thomas 2025-10-24T06:50:29.548199Z

dang... that is quite some achievements!

seancorfield 2025-10-24T15:35:07.503809Z

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! 🙂

😄 1