[
https://issues.apache.org/jira/browse/AMQ-9808?focusedWorklogId=995927&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-995927
]
ASF GitHub Bot logged work on AMQ-9808:
---------------------------------------
Author: ASF GitHub Bot
Created on: 12/Dec/25 09:00
Start Date: 12/Dec/25 09:00
Worklog Time Spent: 10m
Work Description: jbonofre merged PR #1536:
URL: https://github.com/apache/activemq/pull/1536
Issue Time Tracking
-------------------
Worklog Id: (was: 995927)
Time Spent: 1h 10m (was: 1h)
> Dead lock when using CRON schedule with AMQ_SCHEDULED_REPEAT
> ------------------------------------------------------------
>
> Key: AMQ-9808
> URL: https://issues.apache.org/jira/browse/AMQ-9808
> Project: ActiveMQ
> Issue Type: Bug
> Components: Job Scheduler
> Affects Versions: 5.19.1, 5.18.7, 6.1.8
> Reporter: Jean-Louis Monteiro
> Priority: Major
> Time Spent: 1h 10m
> Remaining Estimate: 0h
>
> This bug is highlighted by the current JmsSchedulerTest@testCron() test case.
> When using a CRON expression with repeat != 0, there is a deadlock happening
> between JobSchedulerImpl and JobSchedulerStoreImpl.
> The original cron job is read inside JobSchedulerImpl.mainLoop(). That loop
> holds JobSchedulerStoreImpl.readLockIndex() for the whole iteration.
> When it hits the cron branch with repeat != 0, the code tries to spawn a new
> (non-cron) schedule by calling schedule(jobId, payload, "", delay, period,
> repeat) while the read lock is still held. schedule() writes a new
> KahaAddScheduledJobCommand, and JobSchedulerStoreImpl.process() needs the
> same indexLock in write mode. Since the scheduler thread already holds the
> read lock, it can’t acquire the write lock and blocks forever.
>
> {code:java}
> "JobScheduler:JMS" #46 [38147] daemon prio=5 os_prio=31 cpu=3.54ms
> elapsed=273.52s tid=0x0000000ac8330800 nid=38147 waiting on condition
> [0x0000000171df6000]
> java.lang.Thread.State: WAITING (parking)
> at jdk.internal.misc.Unsafe.park([email protected]/Native Method)
> - parking to wait for <0x0000000343ac3e80> (a
> java.util.concurrent.locks.ReentrantReadWriteLock$NonfairSync)
> at
> java.util.concurrent.locks.LockSupport.park([email protected]/LockSupport.java:223)
> at
> java.util.concurrent.locks.AbstractQueuedLongSynchronizer.acquire([email protected]/AbstractQueuedLongSynchronizer.java:410)
> at
> java.util.concurrent.locks.AbstractQueuedLongSynchronizer.acquire([email protected]/AbstractQueuedLongSynchronizer.java:650)
> at
> java.util.concurrent.locks.ReentrantReadWriteLock$WriteLock.lock([email protected]/ReentrantReadWriteLock.java:966)
> at
> org.apache.activemq.store.kahadb.scheduler.JobSchedulerStoreImpl$8.visit(JobSchedulerStoreImpl.java:684)
> at
> org.apache.activemq.store.kahadb.data.KahaAddScheduledJobCommand.visit(KahaAddScheduledJobCommand.java:283)
> at
> org.apache.activemq.store.kahadb.scheduler.JobSchedulerStoreImpl.process(JobSchedulerStoreImpl.java:679)
> at
> org.apache.activemq.store.kahadb.AbstractKahaDBStore.store(AbstractKahaDBStore.java:495)
> at
> org.apache.activemq.store.kahadb.AbstractKahaDBStore.store(AbstractKahaDBStore.java:403)
> at
> org.apache.activemq.store.kahadb.scheduler.JobSchedulerImpl.doSchedule(JobSchedulerImpl.java:252)
> at
> org.apache.activemq.store.kahadb.scheduler.JobSchedulerImpl.schedule(JobSchedulerImpl.java:100)
> at
> org.apache.activemq.store.kahadb.scheduler.JobSchedulerImpl.mainLoop(JobSchedulerImpl.java:782)
> at
> org.apache.activemq.store.kahadb.scheduler.JobSchedulerImpl.run(JobSchedulerImpl.java:699)
> at java.lang.Thread.runWith([email protected]/Thread.java:1487)
> at java.lang.Thread.run([email protected]/Thread.java:1474)
> "ActiveMQ Journal Checkpoint Worker" #43 [38915] daemon prio=5 os_prio=31
> cpu=4.77ms elapsed=273.69s tid=0x0000000ac82f5000 nid=38915 waiting on
> condition [0x00000001719de000]
> java.lang.Thread.State: WAITING (parking)
> at jdk.internal.misc.Unsafe.park([email protected]/Native Method)
> - parking to wait for <0x0000000343ac3e80> (a
> java.util.concurrent.locks.ReentrantReadWriteLock$NonfairSync)
> at
> java.util.concurrent.locks.LockSupport.park([email protected]/LockSupport.java:223)
> at
> java.util.concurrent.locks.AbstractQueuedLongSynchronizer.acquire([email protected]/AbstractQueuedLongSynchronizer.java:410)
> at
> java.util.concurrent.locks.AbstractQueuedLongSynchronizer.acquire([email protected]/AbstractQueuedLongSynchronizer.java:650)
> at
> java.util.concurrent.locks.ReentrantReadWriteLock$WriteLock.lock([email protected]/ReentrantReadWriteLock.java:966)
> at
> org.apache.activemq.store.kahadb.AbstractKahaDBStore.checkpointCleanup(AbstractKahaDBStore.java:739)
> at
> org.apache.activemq.store.kahadb.AbstractKahaDBStore$2.run(AbstractKahaDBStore.java:707)
> {code}
>
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information, visit: https://activemq.apache.org/contact