Deadlock detection in workflow code


In one of the workflows we often get PotentialDeadlockException and below is one of he exception message. Looking at the message, it just prints detectionTimestamp , stacktraceTimestamp and threadDumpTimestamp.

But according the sdk code, if I am right, it is suppose to dump other current thread dumps if there are any thread exists. But looks like it is not present. Which means no thread currently exists ? Anything else we could try to point deadlock detection here ?

Caused By: io.temporal.internal.sync.PotentialDeadlockException: Potential deadlock detected. workflow thread "workflow-root" didn't yield control for over a second. {detectionTimestamp=1650913273813stacktraceTimestamp=1650913274221threadDumpTimestamp=1650913274221} 
java.base@11.0.14/jdk.internal.misc.Unsafe.park(Native Method)
java.base@11.0.14/java.util.concurrent.locks.LockSupport.park(Unknown Source)
java.base@11.0.14/java.util.concurrent.locks.AbstractQueuedSynchronizer.parkAndCheckInterrupt(Unknown Source)
java.base@11.0.14/java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireQueued(Unknown Source)
java.base@11.0.14/java.util.concurrent.locks.AbstractQueuedSynchronizer.acquire(Unknown Source)
java.base@11.0.14/java.util.concurrent.locks.ReentrantLock.lock(Unknown Source)
java.base@11.0.14/java.util.concurrent.Executors$ Source)
java.base@11.0.14/ Source)
java.base@11.0.14/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
java.base@11.0.14/java.util.concurrent.ThreadPoolExecutor$ Source)
java.base@11.0.14/ Source)

Can you show the whole stack trace and workflow history please?
Assuming you are not getting this during debugging, right?

This could be caused by things like

  • Loop in your workflow code that spins forever
  • External api calls you might have in your workflow code or data converter that block for over a second
  • Using non-temporal apis for things like synchronization, or blocking with Thread.sleep for example

Take a look at workflow code constraints see if your workflow code might not follow them for some reason.