massdosage / citrine-scheduler

Java web application which can be used to configure, manage and monitor the running of various tasks
Apache License 2.0
4 stars 4 forks source link

ObjectAlreadyExistsException #29

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Occasionally when trying to trigger a build manually from the web ui, citrine 
will throw an ObjectAlreadyExistsException (full stack below). Resetting it 
should fix this. However, recently kicking off the job seemed to misfire - 
there was no log and no running process, but subsequent runs would cause the 
exception. A reset would then allow the run to be kicked off, but again with no 
log or process. The real bug here might be the process not being kicked off for 
some reason.

Error scheduling task with id 98; nested exception is 
org.quartz.ObjectAlreadyExistsException: Unable to store Job with name: '98' 
and group: 'playlinks-immediate', because one already exists with this 
identification. 
fm.last.citrine.scheduler.SchedulerManager.runTaskNow(SchedulerManager.java:140)
fm.last.citrine.web.TaskController.run(TaskController.java:145)
sun.reflect.GeneratedMethodAccessor246.invoke(Unknown Source)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.jav
a:25)
java.lang.reflect.Method.invoke(Method.java:597)
org.springframework.web.servlet.mvc.multiaction.MultiActionController.invokeName
dMethod(MultiActionController.java:473)
org.springframework.web.servlet.mvc.multiaction.MultiActionController.handleRequ
estInternal(MultiActionController.java:410)
org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractCon
troller.java:153)
org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(Simple
ControllerHandlerAdapter.java:48)
org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.j
ava:875)
org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.ja
va:807)
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet
.java:571)
org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:501
)
javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilt
erChain.java:290)
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.
java:206)
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:2
33)
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:1
91)
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109
)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849)
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Pr
otocol.java:583)
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454)
java.lang.Thread.run(Thread.java:619)

Original issue reported on code.google.com by massdosage on 15 Sep 2010 at 11:41

GoogleCodeExporter commented 9 years ago
After some investigation, this appears to occur when there are 10 running 
tasks. Our current theory is that Quartz has a maximum of 10 running threads, 
so when you try trigger something to run immediately after this max is reached, 
nothing shows up in the GUI as it isn't actually running. If you then try add 
it again you get the above exception as Quartz has actually stored it to start 
running as soon as it has a worker thread available.

We should:

- Check if we can get the status of the scheduled job - i.e. is it running now 
or was the pool full? We could then return some info to the user to explain 
this.
- When we try schedule something (now or later) if we could detect that there 
are no worker threads available we could warn the user.
- We should make the size of this worker thread pool configurable. According to 
the Quartz documentation this can be done by putting a quartz.properties file 
on the classpath. We'd prefer to do it using Spring and citrine.properties if 
possible.
* Ideally the thread pool wouldn't have a hard, fixed-size limit but would be 
dynamic, but this might require code changes inside Quartz.

Original comment by massdosage on 20 Sep 2010 at 5:23

GoogleCodeExporter commented 9 years ago
Size of thread pool is now configurable by putting all quartz properties in 
citrine.properties and telling Quartz to use this for its config.

Haven't yet solved figuring out logging if something can't be scheduled because 
pool is full.

Original comment by massdosage on 21 Sep 2010 at 5:16

GoogleCodeExporter commented 9 years ago

Original comment by massdosage on 21 Sep 2010 at 5:20