adzerk-oss / boot-cljs-example

Example application using boot, boot-cljs, boot-cljs-repl, and boot-reload.
102 stars 35 forks source link

OutOfMemoryError #2

Closed soasme closed 9 years ago

soasme commented 9 years ago

boot serve raise Exception:

f2e [master●] % boot serve -d target/ watch speak cljs-repl cljs -usO none reload
<< started reload server on ws://localhost:8090 >>
<< started web server on http://127.0.0.1:3000 (serving: target/) >>
Starting file watcher (CTRL-C to quit)...

nREPL server listening: 0.0.0.0:65208
Compiling main.js...
Exception in thread "main"
Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "main"
Exception in thread "Thread-18"
Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "Thread-18"
^CJava HotSpot(TM) 64-Bit Server VM warning: Exception java.lang.OutOfMemoryError occurred dispatching signal SIGINT to handler- the VM may need to be forcibly terminated
[1]    44108 killed     boot serve -d target/ watch speak cljs-repl cljs -usO none reload

f2e [master●] % boot watch speak cljs-repl cljs -usO none reload
<< started reload server on ws://localhost:8090 >>
Starting file watcher (CTRL-C to quit)...

nREPL server listening: 0.0.0.0:65217
Compiling main.js...
Adding <script> tags to html...
Elapsed time: 12.351 sec
alandipert commented 9 years ago

Hi, thanks for the report! If you have the memory available, you can try a bigger maximum JVM heap size:

BOOT_JVM_OPTIONS="-Xmx4g" boot serve -d target/ watch speak cljs-repl cljs -usO none reload

What java -version are you on? Also, what does boot -V report?

soasme commented 9 years ago

java version "1.7.0_10"

4.5% MEM: /usr/bin/java -Xmx4g -jar /usr/local/

% boot -V

https://github.com/boot-clj/boot

Wed Nov 05 21:54:33 CST 2014

BOOT_CLOJURE_VERSION=1.6.0 BOOT_VERSION=2.0.0-pre14

f2e [master●] % BOOT_JVM_OPTIONS="-Xmx4g" boot serve -d target/ watch speak cljs-repl cljs -usO none reload
<< started reload server on ws://localhost:8090 >>
<< started web server on http://127.0.0.1:3000 (serving: target/) >>
Starting file watcher (CTRL-C to quit)...

nREPL server listening: 0.0.0.0:65492
Compiling main.js...
Exception in thread "main"
Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "main"

:(

alandipert commented 9 years ago

Weird!

lein-simpleton is awesome, but uses HTTP stuff built into the JVM that I suspect is leaking memory somehow. I'll rework the serve task later to use run-jetty and wrap-resource instead, and we can see if this still happens.

alandipert commented 9 years ago

Hi, OK! I was able to reproduce your problems in Java 7 and can suggest a fix. However, if you can, I recommend upgrading to Java 8. Using it I did not experience memory problems.

The thing to try for Java 7 is:

BOOT_JVM_OPTIONS="-XX:MaxPermSize=128m" boot serve -d target/ watch speak cljs-repl cljs -usO none reload

You may also experiment with other BOOT_JVM_OPTIONS on the JVM Options wiki page.

Let us know how it goes.

Edit - also you should run boot -u to upgrade your boot; we're at -pre16 now.

soasme commented 9 years ago

It works! Thank you so much.

PS. boot goes so fast. I'm on pre18 now :)

alandipert commented 9 years ago

Great! pre-19 is out btw ;-)

mhuebert commented 9 years ago

I get the same out of memory error when I clone this repo and run boot dev. I'm on a mac with 16 gigs of memory, but I'm guessing that doesn't matter since it's a java setting. I'm on java version "1.7.0_51". Going to try JDK 8 now.

alandipert commented 9 years ago

@mhuebert did you try BOOT_JVM_OPTIONS="-XX:MaxPermSize=128m" on Java 7 and it didn't help?

In any case it's still a really good idea to upgrade to Java 8.

mhuebert commented 9 years ago

I tried that, but got this error:

$ BOOT_JVM_OPTIONS="-XX:MaxPermSize=128m" boot serve -d target/ watch speak cljs-repl cljs -usO none reload

Writing boot_cljs_repl.cljs...

<< stopping Jetty... >>
             clojure.lang.ExceptionInfo: java.lang.IllegalArgumentException: Unknown option: "-u"
    data: {:file
           "/var/folders/gk/bxgzz2tn5gs2249f05hkw2jh0000gn/T/boot.user631656520500402001.clj",
           :line 13}
java.util.concurrent.ExecutionException: java.lang.IllegalArgumentException: Unknown option: "-u"
     java.lang.IllegalArgumentException: Unknown option: "-u"
          boot.core/construct-tasks                         core.clj:  661
                                ...
                 clojure.core/apply                         core.clj:  624
              boot.user/eval1000/fn  boot.user631656520500402001.clj:   15
clojure.core/binding-conveyor-fn/fn                         core.clj: 1910

I've upgraded to java 8, and it works now. (For anyone here looking to do the same thing on OSX, I recommend this download page as others I found did not install correctly)

sjatkins commented 8 years ago

boot-reload seems evil. I have BOOT_JVM_OPTIONS="-Xmx2g -XX:MaxPermSize=1g" and I still hit OOM when reload is in my boot chain along with the repl. Drop either of those and the problem disappears. This is on Oracle java 1.7.0_10 also. Trying 8.