Facing issue with scheduler tasks on Cuba 7.2.13. Have 4 scheduler task configured as singleton to run daily on specified cron settings. Smallest task execution time is around 1 sec and for largest task its around 90 sec.
These task were executing fine. No environment changes done but now task history shows no execution record and tasks are not executed. Manually executing any task at the configured time gives no error and success is recorded in task execution history
In logs found
Exception in thread “cuba_core_scheduler-16” java.lang.IllegalMonitorStateException
at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.signal(AbstractQueuedSynchronizer.java:1939)
at java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:1103)
at java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:809)
at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1074)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1134)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:750)
Pls refer attached screenshot for attributes. Application is hosted on a single server, LAST_START_SERVER is localhost and LAST_START_TIME shows it last executed on 01 Aug 25
Take thread dump from the application server and look what ScheduledRunnerThread-XXX threads are doing.
Thread dump can be taken from the server console (jstack utility) or from JMX console - “java.lang:type=Threading” mbean.
Temporarily change log settings for “com.haulmont.cuba.core.app.scheduling.Scheduling” logger to DEBUG or even better - TRACE level.
Change threshold of your main logging appender to TRACE also.
It can be done via Server Log administration screen.
Check what messages are written into the log. Scheduling mechanism writes many log messages.
Have you tried to restart the application server?
Does the scheduling resume its functioning after restart?
/**
* @return Maximum size of thread pool which is used to process scheduled tasks
*/
@Property("cuba.schedulingThreadPoolSize")
@DefaultInt(10)
int getSchedulingThreadPoolSize();
and
cuba.schedulingActive
com.haulmont.cuba.core.app.ServerConfig#getSchedulingActive
Our server is scheduled for shutdown at 12:30 am and start up at 6:30 am. Rescheduled all 4 scheduled tasks to trigger immediately after server startup at 6:35 am to 6:39 am. Added in cuba.schedulingThreadPoolSize=10 in server.log (26.8 KB)
app.properties file
Next morning, 3rd Sept, all 4 jobs are triggered, executed successfully and recorded in scheduler history. No more scheduled tasks for the day.
Later server logs show java.lang.IllegalMonitorStateException
Exception in thread “cuba_core_scheduler-4” java.lang.IllegalMonitorStateException
at java.util.concurrent.locks.ReentrantLock$Sync.tryRelease(ReentrantLock.java:151)
at java.util.concurrent.locks.AbstractQueuedSynchronizer.release(AbstractQueuedSynchronizer.java:1261)
at java.util.concurrent.locks.ReentrantLock.unlock(ReentrantLock.java:457)
Same exceptions happen at server shutdown
Next day, 4 Sept, immediately after server startup same java.lang.IllegalMonitorStateException occurred, and no scheduled task was triggered. Same exceptions happen at server shutdown
If these exceptions happen during normal server functioning (not during shutdown), it looks like a bug somewhere in java.util.concurrent code.
But there is no clue if the bug was provoked by the CUBA code.