luminus-framework / luminus-template

a template project for the Luminus framework
http://www.luminusweb.net/
MIT License
648 stars 146 forks source link

Exception when shutting down (sometimes) #144

Closed ulsa closed 9 years ago

ulsa commented 9 years ago

I sometimes get an exception when hitting Ctrl-C after lein run. Happened in two different projects just now, but I can't reproduce it consistently. Perhaps you can make sense of the stacktrace.

$ lein new luminus lumitest2 +cljs
Retrieving luminus/lein-template/2.9.8.1/lein-template-2.9.8.1.pom from clojars
Retrieving luminus/lein-template/2.9.8.1/lein-template-2.9.8.1.jar from clojars
Generating a Luminus project.
$ cd lumitest2/
$ lein run
09:34:31.386 [main] DEBUG org.jboss.logging - Logging Provider: org.jboss.logging.Slf4jLoggerProvider
15-Jul-29 09:34:31 ulsamac.local INFO [lumitest2.handler] - nREPL server started on port 7000
15-Jul-29 09:34:31 ulsamac.local INFO [lumitest2.handler] - 
-=[lumitest2 started successfully using the development profile]=-
09:34:31.960 INFO  [org.projectodd.wunderboss.web.Web] (main) Registered web context /
15-Jul-29 09:34:31 ulsamac.local INFO [lumitest2.core] - server started on port: 3000
^C
Exception in thread "Thread-3" java.util.concurrent.RejectedExecutionException: Task java.util.concurrent.FutureTask@4bade623 rejected from java.util.concurrent.ThreadPoolExecutor@456a0126[Shutting down, pool size = 2, active threads = 2, queued tasks = 0, completed tasks = 1]
    at java.util.concurrent.ThreadPoolExecutor$AbortPolicy.rejectedExecution(ThreadPoolExecutor.java:2047)
    at java.util.concurrent.ThreadPoolExecutor.reject(ThreadPoolExecutor.java:823)
    at java.util.concurrent.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:1369)
    at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:134)
    at clojure.core$future_call.invoke(core.clj:6680)
    at taoensso.timbre$fn__13604.invoke(timbre.clj:556)
    at clojure.lang.AFn.applyToHelper(AFn.java:152)
    at clojure.lang.AFn.applyTo(AFn.java:144)
    at clojure.core$apply.invoke(core.clj:630)
    at taoensso.encore$memoize_STAR_$fn__13001$fn__13010$fn__13012.invoke(encore.clj:1573)
    at clojure.lang.Delay.deref(Delay.java:37)
    at clojure.core$deref.invoke(core.clj:2206)
    at taoensso.encore$memoize_STAR_$fn__13001.doInvoke(encore.clj:1563)
    at clojure.lang.RestFn.invoke(RestFn.java:397)
    at taoensso.timbre$log1_fn$fn__13421.invoke(timbre.clj:338)
    at clojure.lang.Delay.deref(Delay.java:37)
    at clojure.lang.Delay.force(Delay.java:27)
    at clojure.core$force.invoke(core.clj:730)
    at taoensso.timbre$default_output_fn.invoke(timbre.clj:51)
    at taoensso.timbre$default_output_fn.invoke(timbre.clj:45)
    at taoensso.timbre.appenders.core$println_appender$fn__13268.invoke(core.clj:101)
yogthos commented 9 years ago

The trace looks like it's coming from the timbre logging library. Might be a race condition where it's trying to do something during shutdown. It doesn't appear to be a luminus specific bug though.

ulsa commented 9 years ago

Yes, I figured it had to do with timbre too, but wanted you to take a look.

yogthos commented 9 years ago

There's really nothing I can do about it in Luminus, when the app quits the threads will be shut down and timbre doesn't appear to provide any explicit cleanup function. Perhaps it would make sense to open an issue with Timbre itself?