Handle RuntimeException during webhooks notification
Issue:
When RuntimeException is being thrown during webhooks post it results in
IllegalMonitorStateException [1] (reproduced only once :/) being thrown
from underlying executor leaving it completely broken. As a result
further notifications will not be neither processed nor posted.
Solution:
Catch Throwable and handle it gently.
[1]
2018-03-19 17:40:08,646|ERROR|webhooks-1|WorkQueue.java|81| WorkQueue thread webhooks-1 threw exception
java.lang.IllegalMonitorStateException
at java.base/java.util.concurrent.locks.ReentrantLock$Sync.tryRelease(Unknown Source)
at java.base/java.util.concurrent.locks.AbstractQueuedSynchronizer.release(Unknown Source)
at java.base/java.util.concurrent.locks.ReentrantLock.unlock(Unknown Source)
at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(Unknown Source)
at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor.getTask(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.base/java.lang.Thread.run(Unknown Source)
Change-Id: I4ebda02295c0261c746a1b7b74a2f0bd7978da6c
Signed-off-by: Jacek Centkowski <jcentkowski@collab.net>
2 files changed