We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 619f2fd commit 20e1ef9Copy full SHA for 20e1ef9
src/clj/backtype/storm/timer.clj
@@ -28,8 +28,12 @@
28
(let [[time-secs _ _ :as elem] (.peek queue)]
29
(if elem
30
(if (>= (current-time-secs) time-secs)
31
- (locking lock
32
- ((second (.poll queue))))
+ ;; can't hold the lock while executing the task function, or else
+ ;; deadlocks are possible (if the task function locks another lock
33
+ ;; and another thread locks that other lock before trying to schedule
34
+ ;; something on the timer)
35
+ (let [exec-fn (locking lock (second (.poll queue)))]
36
+ (exec-fn))
37
(Time/sleepUntil (to-millis time-secs))
38
)
39
(Time/sleep 10000)
0 commit comments