Skip to content

Commit 7d77fa4

Browse files
jafingerhutstuarthalloway
authored andcommitted
CLJ-823: Use release-pending-sends to avoid seque-into-seque deadlock
Signed-off-by: Stuart Halloway <[email protected]>
1 parent 85169b7 commit 7d77fa4

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

src/clj/clojure/core.clj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5111,6 +5111,7 @@
51115111
(do @agt nil) ;touch agent just to propagate errors
51125112
(do
51135113
(send-off agt fill)
5114+
(release-pending-sends)
51145115
(cons (if (identical? x NIL) nil x) (drain)))))))]
51155116
(send-off agt fill)
51165117
(drain))))

test/clojure/test_clojure/agents.clj

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,13 @@
176176
(is (= (.size small-lbq)
177177
(dec queue-backlog)))))))
178178

179+
;; Check for a deadlock condition when one seque was fed into another
180+
;; seque. Note that this test does not throw an exception or
181+
;; otherwise fail if the issue is not fixed -- it simply deadlocks and
182+
;; hangs until killed.
183+
(deftest seque-into-seque-deadlock
184+
(is (= (range 10) (seque 3 (seque 3 (range 10))))))
185+
179186
; http://clojure.org/agents
180187

181188
; agent

0 commit comments

Comments
 (0)