clojurescript 2026-08-06

This is probably a #C053AK3F9 -level question, but it seems specific to ClojureScript. I appear to be getting a certain kind of error randomly. When it does happen, it shows in the console/terminal, and usually the webapp I'm coding still works. (For background, the webapp is pretty simple, with me having started with the CLJS Quick Start Guide skeleton and just added more and more code to that one file.) • The error seems completely random and not repeatable. • Compiling the same code twice can result it getting the error one of those times but not the other. • It can also happen more than once after a single compile. • It can happen before the webapp code is run, or after. • I believe it can also happen just from page reloads, but while I was testing just now I was unable to repeat that. The error is this or similar (always like the top line except sometimes Thread-128 instead or in addition to Thread-127, and I'm not sure whether the rest of the lines can differ):

Exception in thread "Thread-127" java.net.SocketException: Broken pipe
        at java.base/sun.nio.ch.SocketDispatcher.write0(Native Method)
        at java.base/sun.nio.ch.SocketDispatcher.write(SocketDispatcher.java:65)
        at java.base/sun.nio.ch.NioSocketImpl.tryWrite(NioSocketImpl.java:408)
        at java.base/sun.nio.ch.NioSocketImpl.implWrite(NioSocketImpl.java:425)
        at java.base/sun.nio.ch.NioSocketImpl.write(NioSocketImpl.java:458)
        at java.base/sun.nio.ch.NioSocketImpl$2.write(NioSocketImpl.java:825)
        at java.base/java.net.Socket$SocketOutputStream.implWrite(Socket.java:1097)
        at java.base/java.net.Socket$SocketOutputStream.write(Socket.java:1087)
        at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
        at java.base/java.lang.reflect.Method.invoke(Method.java:565)
        at clojure.lang.Reflector.invokeMatchingMethod(Reflector.java:196)
        at clojure.lang.Reflector.invokeInstanceMethodOfClass(Reflector.java:106)
        at clojure.lang.Reflector.invokeInstanceMethod(Reflector.java:98)
        at cljs.repl.server$send_and_close.invokeStatic(server.clj:171)
        at cljs.repl.server$send_and_close.invoke(server.clj:144)
        at cljs.repl.server$send_and_close.invokeStatic(server.clj:152)
        at cljs.repl.server$send_and_close.invoke(server.clj:144)
        at cljs.repl.server$send_and_close.invokeStatic(server.clj:150)
        at cljs.repl.server$send_and_close.invoke(server.clj:144)
        at cljs.repl.server$send_404.invokeStatic(server.clj:177)
        at cljs.repl.server$send_404.invoke(server.clj:176)
        at cljs.repl.server$dispatch_request.invokeStatic(server.clj:196)
        at cljs.repl.server$dispatch_request.invoke(server.clj:185)
        at cljs.repl.server$handle_connection.invokeStatic(server.clj:209)
        at cljs.repl.server$handle_connection.invoke(server.clj:205)
        at cljs.repl.server$server_loop$fn__8492.invoke(server.clj:219)
        at clojure.core$binding_conveyor_fn$fn__5844.invoke(core.clj:2051)
        at clojure.lang.AFn.run(AFn.java:22)
        at java.base/java.lang.Thread.run(Thread.java:1516)
I was originally thinking it could have to do with transient CPU slow-downs or the tens of println statements I am using or the tens of js/console.log statements I am using. Println statements sometimes fail to come through and do so with no reported errors, though, so they don't seem connected. JS console logs always seem to come through even if these errors do get reported, so they too don't seem connected. That just leaves CPU usage, but I'm really guessing here.

When you start the compilation+repl process, it should tell you that the compilation output is logged to some file, like out/watch.log. Are there any other exceptions in that file?

The error seems to have gone quiet for a bit and I haven't been able to trigger it with just compilation, but I was able to trigger it or a similar error by hammering the browser refresh hotkey, and watch.log contains this:

Building ...
#error {
 :cause Requested array size exceeds VM limit
 :via
 [{:type java.lang.OutOfMemoryError
   :message Requested array size exceeds VM limit
   :at [java.util.Arrays copyOf Arrays.java 3537]}]
 :trace
 [[java.util.Arrays copyOf Arrays.java 3537]
  [java.lang.AbstractStringBuilder ensureCapacityNewCoder AbstractStringBuilder.java 282]
  [java.lang.AbstractStringBuilder append AbstractStringBuilder.java 897]
  [java.lang.StringBuffer append StringBuffer.java 422]
  [java.io.StringWriter write StringWriter.java 79]
  [java.io.StringWriter append StringWriter.java 213]
  [java.io.StringWriter append StringWriter.java 43]
  [clojure.core$fn__7430 invokeStatic core_print.clj 218]
  [clojure.core$fn__7430 invoke core_print.clj 212]
  [clojure.lang.MultiFn invoke MultiFn.java 234]
  [clojure.core$pr_on invokeStatic core.clj 3704]
  [clojure.core$pr_on invoke core.clj 3698]
  [clojure.core$print_sequential invokeStatic core_print.clj 66]
  [clojure.core$fn__7436 invokeStatic core_print.clj 225]
  [clojure.core$fn__7436 invoke core_print.clj 225]
  [clojure.lang.MultiFn invoke MultiFn.java 234]
  [clojure.core$pr_on invokeStatic core.clj 3704]
  [clojure.core$pr_on invoke core.clj 3698]
  [clojure.core$print_prefix_map$fn__7439 invoke core_print.clj 233]
  [clojure.core$print_sequential invokeStatic core_print.clj 66]
  [clojure.core$print_prefix_map invokeStatic core_print.clj 229]
  [clojure.core$print_map invokeStatic core_print.clj 238]
  [clojure.core$fn__7468 invokeStatic core_print.clj 266]
  [clojure.core$fn__7468 invoke core_print.clj 263]
  [clojure.lang.MultiFn invoke MultiFn.java 234]
  [clojure.core$pr_on invokeStatic core.clj 3704]
  [clojure.core$pr_on invoke core.clj 3698]
  [clojure.core$print_prefix_map$fn__7439 invoke core_print.clj 233]
  [clojure.core$print_sequential invokeStatic core_print.clj 66]
  [clojure.core$print_prefix_map invokeStatic core_print.clj 229]
  [clojure.core$print_map invokeStatic core_print.clj 238]
  [clojure.core$fn__7468 invokeStatic core_print.clj 266]]}
Watching paths: /home/a/Documents/programming/clojurescript/mastermind-2026-07/src
So that memory and array size reference makes me think processing/memory bottleneck?

I will try to remember to check the contents of watch.log next time the error occurs during compilation, just in case that is a different kind of error. The error text I originally pasted and the contents of watch.log above do look very different.

Right, I've also seen this error, I mentioned it in #C07UQ678E.