This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-07-06
Channels
- # aleph (1)
- # announcements (3)
- # asami (32)
- # aws (12)
- # babashka (6)
- # beginners (43)
- # calva (36)
- # cider (3)
- # clj-kondo (3)
- # cljs-dev (2)
- # clojars (6)
- # clojure (66)
- # clojure-europe (14)
- # clojure-uk (2)
- # clojurescript (12)
- # conjure (1)
- # core-async (27)
- # cursive (17)
- # data-science (9)
- # datahike (1)
- # datomic (28)
- # emacs (34)
- # events (1)
- # girouette (3)
- # jobs (1)
- # klipse (4)
- # lsp (26)
- # malli (5)
- # off-topic (38)
- # portal (1)
- # releases (1)
- # shadow-cljs (72)
- # sql (7)
- # tools-deps (5)
- # vim (9)
- # xtdb (18)
if anyone wants to crack into this https://clojure.atlassian.net/browse/ASYNC-247, would love a hand /cc @bronsa @hiredman
this would be a phenomenal screen recording of how you debug it or perhaps an article if whoever fixes it is interested
I suspect https://clojure.atlassian.net/browse/CLJ-2145 may fix it already
yeah I can't repro with that fix applied
[~/src/clojure]> clj -J-Xmx32m -Sdeps '{:deps {org.clojure/core.async {:mvn/version "1.5.648"} org.clojure/clojure {:mvn/version "1.12.0-master-SNAPSHOT"}}}'
Clojure 1.12.0-master-SNAPSHOT
user=> (require '[clojure.core.async :as a])
nil
user=> (let [c (a/chan)] (a/onto-chan! c (range 1000000)) (while (a/<!! c)))
nil
user=>
yeah, I confirm the fix. I've just glanced at the core.async code so I can't offer a precise explanation, but the code shape looks "right" to hit the issue CLJ-2145 describes
I'm not saying you're wrong, but that doesn't match a couple things I saw in debugging
hmmm, though I didn't get an OOM in 1.12.0-alpha1
on this second run either, so hang on, maybe I keep getting lucky 🙂
the expansion of onto-chan's go-loop is something like this
Indexes 6/7/8 are the locals - you can see in lines 19-39 those closed over :once thunks are invoked, then saved and vs is saved as index 9 (and 10) later
in a debugger I see I think the original coll as the one that is retained (index 7)
so that's why I don't see a match to CLJ-2145 (no conditional, and different place where I see the head retained)
you both have more experience than me in here, I'm not sure what the analogous approach to locals clearing in jvm clojure would be - how easily can we know enough to not save those locals in the state array?
(separately, that expansion looks like it's redoing the resolution of all of the locals multiple times - ch, then ch and coll, then ch and coll and close?, a lot of this smells unnecessary)
afaict, it doesn't :)
the enviroment re-creation stuff is meant to make it possible to emit big chunks of normal code that doesn't require rewriting as a state machine, there just aren't any big chunks here
there is a pass in tools.emitter.jvm
to annotate locals at the point where they can be cleared. maybe I can try reusing that and emitting an aset to nil