Hi there. I am using Akka 1.2-RC6. I was able to take the Mist example
in the docs and figure out how to make it work using a Maven build and
running 'mvn jetty:run'. I have two minor problems that I would like
help in troubleshooting.
First Startup is Slooooooooooow. I get the jetty starting message:
[INFO] Starting jetty 8.0.0.M2 ...
2011-09-14 23:30:28.705:INFO::jetty-8.0.0.M2
2011-09-14 23:30:32.062:INFO::No Transaction manager found - if your
webapp requires one, please configure one.
Then after the nice big Akka logo prints I get this:
Starting Akka...
Akka started successfully
2011-09-14 23:31:03.031:INFO::Started
SelectChann...@0.0.0.0:8080
Thats almost a minute. I'm running this on an I5 MBP with 8GB of RAM.
Any clues as to why its taking so long to startup?
Second, on shutdown I get the exception below after I control-C the
'mvn jetty:run' command:
2011-09-14 18:16:22.142:WARN::FAILED
JettyWebAppContext@1a06f956@1a06f956/,file:akka-http-example/src/main/
webapp/,file:akka-http-example/src/main/webapp/:
java.lang.IllegalStateException: Shutdown in progress
2011-09-14 18:16:22.142:WARN::FAILED
ContextHandlerCollection@11e04129: java.lang.IllegalStateException:
Shutdown in progress
2011-09-14 18:16:22.142:WARN::FAILED HandlerCollection@19d5f3ea:
java.lang.IllegalStateException: Shutdown in progress
[ERROR] [9/14/11 6:16 PM] [Thread-3] [Switch] Shutdown in progress
java.lang.IllegalStateException: Shutdown in progress
at
java.lang.ApplicationShutdownHooks.add(ApplicationShutdownHooks.java:
39)
at java.lang.Runtime.addShutdownHook(Runtime.java:192)
at akka.actor.Actor$.shutdownHook(Actor.scala:122)
at akka.util.AkkaLoader$$anonfun$shutdown$1.apply$mcV
$sp(AkkaLoader.scala:41)
at akka.util.Switch.liftedTree1$1(LockUtil.scala:126)
at akka.util.Switch.transcend(LockUtil.scala:125)
at akka.util.Switch.switchOff(LockUtil.scala:137)
at akka.util.AkkaLoader.shutdown(AkkaLoader.scala:37)
at akka.servlet.Initializer.contextDestroyed(Initializer.scala:29)
at
org.eclipse.jetty.server.handler.ContextHandler.doStop(ContextHandler.java:
706)
at
org.eclipse.jetty.servlet.ServletContextHandler.doStop(ServletContextHandler.java:
149)
at org.eclipse.jetty.webapp.WebAppContext.doStop(WebAppContext.java:
536)
at
org.mortbay.jetty.plugin.JettyWebAppContext.doStop(JettyWebAppContext.java:
183)
at
org.eclipse.jetty.util.component.AbstractLifeCycle.stop(AbstractLifeCycle.java:
80)
at
org.eclipse.jetty.server.handler.HandlerCollection.doStop(HandlerCollection.java:
247)
at
org.eclipse.jetty.util.component.AbstractLifeCycle.stop(AbstractLifeCycle.java:
80)
at
org.eclipse.jetty.server.handler.HandlerCollection.doStop(HandlerCollection.java:
247)
at
org.eclipse.jetty.util.component.AbstractLifeCycle.stop(AbstractLifeCycle.java:
80)
at
org.eclipse.jetty.server.handler.HandlerWrapper.doStop(HandlerWrapper.java:
106)
at org.eclipse.jetty.server.Server.doStop(Server.java:301)
at
org.eclipse.jetty.util.component.AbstractLifeCycle.stop(AbstractLifeCycle.java:
80)
at
org.eclipse.jetty.util.thread.ShutdownThread.run(ShutdownThread.java:
124)
[INFO] 2011-09-14 18:16:22.197:WARN::FAILED
org.mortbay.jetty.plugin.JettyServer@5ca801b0:
java.lang.IllegalStateException: Shutdown in progress
Jetty server exiting.
[INFO]
------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO]
------------------------------------------------------------------------
[INFO] Total time: 1:24.562s
[INFO] Finished at: Wed Sep 14 18:16:22 PDT 2011
[INFO] Final Memory: 19M/81M
[INFO]
------------------------------------------------------------------------
Shutting down Akka...
2011-09-14 18:16:22.698:WARN::FAILED
JettyWebAppContext@1a06f956@1a06f956/,file:akka-http-example/src/main/
webapp/,file:akka-http-example/src/main/webapp/:
java.lang.IllegalStateException: Shutdown in progress
2011-09-14 18:16:22.698:WARN::FAILED
ContextHandlerCollection@11e04129: java.lang.IllegalStateException:
Shutdown in progress
2011-09-14 18:16:22.698:WARN::FAILED HandlerCollection@19d5f3ea:
java.lang.IllegalStateException: Shutdown in progress
2011-09-14 18:16:22.698:WARN::FAILED
org.mortbay.jetty.plugin.JettyServer@5ca801b0:
java.lang.IllegalStateException: Shutdown in progress
I looks like AkkaLoader.shutdown() calls Actor.shutdownHook.run.
Actor.shutdownHook is a lazy val and it looks like this shutdown is
the first time it gets used. As part of its creation, shutdownHook
calls Runtime.getRuntime.addShutdownHook(new Thread(hook)). Since its
doing this at shutdown time, it looks like the java runtime is not
happy doing that. Any suggestions on how to resolve this?
Other than that, things look great. I needed to do a little hunting
around to get this to work since my web.xml needed the correct
listener but other than that, so far so good.
Thanks for any help.
-Reggie