luminus-framework/luminus-template

Errors after change in source on fresh luminus

Closed this issue · 3 comments

I generated a fresh luminus project with lein new luminus guestbook2 +h2.

However, after changing anything in any source file, for example the routes/home.clj I get the following output below. I have Leiningen version 2.6.1 and no .lein/profiles.clj. Any suggestions on how I can fix this are welcome.

robert@MacBook-Pro ~/G/P/C/c/guestbook2> lein run
[2016-03-13 22:43:55,700][DEBUG][org.jboss.logging] Logging Provider: org.jboss.logging.Log4jLoggerProvider
[2016-03-13 22:43:56,791][INFO][luminus.http-server] starting HTTP server on port 3000
[2016-03-13 22:43:56,829][INFO][org.xnio] XNIO version 3.4.0.Beta1
[2016-03-13 22:43:56,885][INFO][org.xnio.nio] XNIO NIO Implementation Version 3.4.0.Beta1
[2016-03-13 22:43:56,940][INFO][org.projectodd.wunderboss.web.Web] Registered web context /
[2016-03-13 22:43:56,941][INFO][luminus.repl-server] starting nREPL server on port 7000
[2016-03-13 22:43:56,959][INFO][guestbook2.core] #'guestbook2.config/env started
[2016-03-13 22:43:56,959][INFO][guestbook2.core] #'guestbook2.core/http-server started
[2016-03-13 22:43:56,959][INFO][guestbook2.core] #'guestbook2.core/repl-server started
[2016-03-13 22:43:56,959][INFO][guestbook2.env]
-=[guestbook2 started successfully using the development profile]=-
"<< stopping.. #'guestbook2.core/http-server (namespace was recompiled)"
[2016-03-13 22:44:48,662][DEBUG][org.projectodd.wunderboss.WunderBoss] Returning existing component for org.projectodd.wunderboss.web.Web:-1645144552, ignoring options.
[2016-03-13 22:44:48,670][INFO][luminus.http-server] HTTP server stopped
">> starting.. #'guestbook2.core/http-server (namespace was recompiled)"
[2016-03-13 22:44:48,671][INFO][luminus.http-server] starting HTTP server on port 3000
[2016-03-13 22:44:48,672][DEBUG][org.projectodd.wunderboss.WunderBoss] Returning existing component for org.projectodd.wunderboss.web.Web:-1645144552, ignoring options.
[2016-03-13 22:44:48,676][INFO][org.projectodd.wunderboss.web.Web] Registered web context /
"<< stopping.. #'guestbook2.core/repl-server (namespace was recompiled)"
[2016-03-13 22:44:48,681][INFO][luminus.repl-server] nREPL server stopped
">> starting.. #'guestbook2.core/repl-server (namespace was recompiled)"
[2016-03-13 22:44:48,681][INFO][luminus.repl-server] starting nREPL server on port 7000
[2016-03-13 22:44:48,684][ERROR][org.xnio.listener] XNIO001007: A channel event listener threw an exception
java.util.concurrent.RejectedExecutionException: XNIO007007: Thread is terminating
at org.xnio.nio.WorkerThread.executeAfter(WorkerThread.java:601)
at io.undertow.util.DateUtils.addDateHeaderIfRequired(DateUtils.java:247)
at io.undertow.server.protocol.http.HttpTransferEncoding.createSinkConduit(HttpTransferEncoding.java:203)
at io.undertow.server.protocol.http.HttpServerConnection.getSinkConduit(HttpServerConnection.java:205)
at io.undertow.server.HttpServerExchange.getResponseChannel(HttpServerExchange.java:1234)
at io.undertow.io.UndertowOutputStream.close(UndertowOutputStream.java:337)
at io.undertow.server.HttpServerExchange$DefaultBlockingHttpExchange.close(HttpServerExchange.java:1768)
at io.undertow.server.HttpServerExchange.endExchange(HttpServerExchange.java:1487)
at io.undertow.server.AbstractServerConnection$CloseSetter.handleEvent(AbstractServerConnection.java:304)
at io.undertow.server.AbstractServerConnection$CloseSetter.handleEvent(AbstractServerConnection.java:284)
at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92)
at org.xnio.StreamConnection.invokeCloseListener(StreamConnection.java:80)
at org.xnio.Connection.writeClosed(Connection.java:117)
at org.xnio.nio.AbstractNioStreamConnection.writeClosed(AbstractNioStreamConnection.java:47)
at org.xnio.nio.NioSocketConduit.terminateWrites(NioSocketConduit.java:182)
at org.xnio.nio.NioSocketConduit.truncateWrites(NioSocketConduit.java:196)
at org.xnio.conduits.ConduitStreamSinkChannel.close(ConduitStreamSinkChannel.java:186)
at org.xnio.IoUtils.safeClose(IoUtils.java:152)
at org.xnio.conduits.WriteReadyHandler$ChannelListenerHandler.forceTermination(WriteReadyHandler.java:57)
at org.xnio.nio.NioSocketConduit.forceTermination(NioSocketConduit.java:108)
at org.xnio.nio.WorkerThread.run(WorkerThread.java:492)
[2016-03-13 22:44:48,756][ERROR][io.undertow.request] Undertow request failed HttpServerExchange{ GET / request {Accept=[text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,/;q=0.8], Accept-Language=[sv-SE,sv;q=0.8,en-US;q=0.6,en;q=0.4,nb;q=0.2,da;q=0.2], Cache-Control=[max-age=0], Accept-Encoding=[gzip, deflate, sdch], User-Agent=[Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.116 Safari/537.36], Connection=[keep-alive], Cookie=[JSESSIONID=WpJrz5DhAbZdFfeuxMasxk3BA5DPP6wzRcOIg4ek], Upgrade-Insecure-Requests=[1], Host=[localhost:3000]} response {Server=[undertow], X-XSS-Protection=[1; mode=block], X-Content-Type-Options=[nosniff], X-Frame-Options=[SAMEORIGIN], Content-Length=[0], Content-Type=[text/html; charset=utf-8]}}
java.io.IOException: UT000034: Stream is closed
at io.undertow.io.UndertowOutputStream.write(UndertowOutputStream.java:116)
at io.undertow.io.UndertowOutputStream.write(UndertowOutputStream.java:102)
at immutant.web.internal.ring$eval8361$fn__8362.invoke(ring.clj:131)
at clojure.lang.MultiFn.invoke(MultiFn.java:238)
at immutant.web.internal.undertow$eval12486$fn__12524$action__12525.invoke(undertow.clj:159)
at immutant.web.internal.undertow$eval12486$fn__12524.invoke(undertow.clj:172)
at immutant.web.internal.ring$eval8279$fn__8302$G__8268__8313.invoke(ring.clj:106)
at immutant.web.internal.ring$write_response.invokeStatic(ring.clj:149)
at immutant.web.internal.ring$write_response.invoke(ring.clj:142)
at immutant.web.internal.undertow$create_http_handler$reify__12564.handleRequest(undertow.clj:239)
at org.projectodd.wunderboss.web.undertow.async.websocket.UndertowWebsocket$2.handleRequest(UndertowWebsocket.java:104)
at io.undertow.server.session.SessionAttachmentHandler.handleRequest(SessionAttachmentHandler.java:68)
at io.undertow.server.Connectors.executeRootHandler(Connectors.java:199)
at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:778)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)

Right, I think what happens is that a recompile gets triggered by the middleware and that causes the HTTP server to bounce. I'll take a look at making sure that part doesn't get reloaded.

Ok, so just pushed out a new template with the fix. You just have to add ^{:on-reload :noop} to any states that shouldn't be reloaded as seen here. I've updated the HTTP and nREPL server defstate definitions to prevent reloading those automatically.

Works great - thanks a lot!