This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-06-22
Channels
- # ai (1)
- # announcements (4)
- # babashka (23)
- # beginners (27)
- # biff (17)
- # calva (5)
- # clerk (6)
- # clj-commons (27)
- # clj-kondo (35)
- # clojars (12)
- # clojure (27)
- # clojure-denver (3)
- # clojure-europe (71)
- # clojure-norway (7)
- # clojure-spec (5)
- # clojure-uk (2)
- # clojurescript (45)
- # data-science (9)
- # datomic (4)
- # dev-tooling (2)
- # devcards (1)
- # hoplon (2)
- # hyperfiddle (36)
- # introduce-yourself (3)
- # malli (11)
- # missionary (2)
- # off-topic (63)
- # polylith (5)
- # rdf (2)
- # reagent (12)
- # schema (1)
- # shadow-cljs (11)
- # sql (6)
- # tools-deps (23)
- # xtdb (6)
Anyone know how to trigger a java.lang.OutOfMemoryError
consistently? Even better a Compressed class space
error? 🧵
This seems to slowly fill up memory, but it is taking some time
(dotimes [i 4] (doto (Thread. (fn [] (dotimes [i 1000000000] (.intern (str (java.util.UUID/randomUUID)))))) .start))
Also I’m actually trying to tirgger the Compressed class space
error which I get time to time in some project, but not consistentlyhmmm not a bad idea I guess 😃
I will keep this in mind next time it happens and see if this could fulfill the requirement for catching it, I’m guessing that this would do it
Thanks for the suggestions! This error sometimes comes up when using #C013B7MQHJQ so I was thinking of a workaround
+1, catching OOM is a bad idea because it means the system is unwell but you just silence it.
@U6T7M9DBR Good question! Polylith uses a classloader to load the projects. After X amount of time (hours/days) this error pops up. The only way to recover from this error in this situation is restarting the Polylith shell. As this breaks the flow and also has some heavy startup time, I was thinking of something more user friendly
(btw, this error doesn’t seem to occur for all users of Polylith, but only specifc bigger projects it seems)
My idea would be to wrap the try/catch around this classloader part specifically
And maybe another important part of my idea would be is that I would destroy the process when this happens, and start a new one 🙂
More specifically, the process would be managed by another babashka process (through pods). This process needs to be told through the bencode format that something bad happened. I think now I’ve explained all the parts of my idea 😅
It’s an internal VM error, so recovering probably works most of the time but is not reliable.
Right now
java version "11.0.7" 2020-04-14 LTS
You can analyse the root cause of the OOM from a heap dump if you’d like. The metaspace memory is inspectable after that as well. It sounds like something is not being garbage collected correctly, or you need more memory
Yeah you are probably right. Unfortunately, it is not happening too often to find it easily, but often enough that it is annoying
I will add that to the polylith profile and wait for the next time. Thanks!
@U0FT7SRLP If it happens again, you can take a heap snapshot manually by doing this in the terminal:
jmap -dump:live,format=b,file=heapdump.bin 12312
The last argument is the PID your Clojure process. You can do this after the OOM happens, it is okay.
After you've obtained the heapdump, you can use MAT (https://www.eclipse.org/mat/) to discover what is leaking memory. It's not a trivial thing to do and takes some time to learn how to use MAT and interpret its results, but overall it's a useful skill to have.Nice! Thanks