IllegalStateException from Timer when multiple stop/starts of a web app (timer already cancelled)

368 views
Skip to first unread message

Toby

unread,
Sep 14, 2010, 9:57:39 AM9/14/10
to javamelody
Hi,

I'm getting the following exception when I stop and start a server
running Java Melody in quick succession in the same VM. It's for
testing purposes so isn't a production issue, however, I'm wondering
if the same instance of timer is kicking around and causing problems
with Java Melody? I'm also not sure what affect it would have if the
exception is thrown from the filter, does it fail Java Melody in some
way? Would it affect other filters etc in the chain?

java.lang.IllegalStateException: Timer already cancelled.
at java.util.Timer.sched(Timer.java:354)
at java.util.Timer.schedule(Timer.java:222)
at org.jrobin.core.RrdNioBackend.<init>(Unknown Source)
at org.jrobin.core.RrdNioBackendFactory.open(Unknown Source)
at org.jrobin.core.RrdDb.<init>(Unknown Source)
at org.jrobin.core.RrdDb.<init>(Unknown Source)
at org.jrobin.core.RrdDb.<init>(Unknown Source)
at org.jrobin.core.RrdDbPool.requestRrdDb(Unknown Source)
at net.bull.javamelody.JRobin.addValue(JRobin.java:275)
at net.bull.javamelody.Collector.collectJRobinValues(Collector.java:
327)
at
net.bull.javamelody.Collector.collectJavaInformations(Collector.java:
302)
at net.bull.javamelody.Collector.collect(Collector.java:242)
at net.bull.javamelody.Collector.collectWithoutErrors(Collector.java:
229)
at
net.bull.javamelody.Collector.collectLocalContextWithoutErrors(Collector.java:
222)
at
net.bull.javamelody.MonitoringFilter.initCollect(MonitoringFilter.java:
254)
at net.bull.javamelody.MonitoringFilter.init(MonitoringFilter.java:
136)
at org.mortbay.jetty.servlet.FilterHolder.doStart(FilterHolder.java:
97)
at
org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:
50)
at
org.mortbay.jetty.servlet.ServletHandler.initialize(ServletHandler.java:
662)
at org.mortbay.jetty.servlet.Context.startContext(Context.java:140)
at
org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:
1250)
at
org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:
517)
at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:
467)
at
org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:
50)
at
org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:
130)
at org.mortbay.jetty.Server.doStart(Server.java:224)
at
org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:
50)

Thanks for any tips,
Toby

Emeric Vernat

unread,
Sep 14, 2010, 3:15:14 PM9/14/10
to javam...@googlegroups.com
Hi,

This exception does not have an impact on the filter: the initialisation
of the filter and of the webapp continues after this exception.
It does not have either any impact on the other filters in the chain.

The impact of this exception could be:
- values will not be collected anymore for graphics after the exception
and certainly until the restart of the server
- statistics of the requests for the day, week, month and year periods
(except the "all" period) will not be updated anymore until the restart
of the server
- the reports will not contain any graphics
or if you dot not see such behavior then there is no impact.

The problem is related to the fact that the class
org.jrobin.core.RrdNioBackend has a java.util.Timer defined as static
final. This timer is correctly canceled by the destroy method of the
javamelody filter, in order to stop the thread of the timer, and of
course this timer instance can't be used anymore after being canceled.

It is my understanding that classes (and so this timer instance) should
be discarded and reloaded by the classloader of the webapp when the
webapp is undeployed and then reinitialized. I may be wrong, except that
it seems to work in Tomcat 6.0.

Do you see the impact as said above?
Which version of jetty do you use?
Which JDK and version do you use?
Have you put the jrobin-1.5.9.1.jar file in the WEB-INF/lib directory of
the webapp or somewhere else?
And the jrobin-1.5.9.1.jar file is not in the classpath (-cp or
-classpath option) of the JVM?
Do you use either the debug mode of the JVM or jrebel?
And have you any ideas on this?

bye, Emeric


Le 14/09/2010 15:57, Toby a �crit :

tony.ba...@gmail.com

unread,
Jul 10, 2012, 2:26:39 PM7/10/12
to javam...@googlegroups.com
Per chance did you guys ever solve this?  I have a similar problem with Tomcat 6, the latest java melody ( javamelody-1.39.0.zip, with jrobin-1.5.9.1.jar ), and java version 1.6.0_33.  I followed all the directions from http://code.google.com/p/javamelody/wiki/UserGuide#Setup and http://aarongreenlee.com/share/monitor-tomcat-performance-with-open-source-software/ ( they both are pretty close to the same, but I gave preference to the official documentation if there were differences ).
Reply all
Reply to author
Forward
0 new messages