(defn test-dbg7 [] ;; test buffers
(record "test-dbg.svg"
(let [c ^{:name "chan"} (async-dbg/chan 1)]
^{:name "thread"}
(async-dbg/thread
(dotimes [n 3]
^{:name "put it!"} (async-dbg/>!! c n))
;; THE BUG IS HERE. FORGOT TO CLOSE GODAMNIT
#_(async-dbg/close! c))
(loop [x (async-dbg/<!! c)]
(when x
(println "-->" x)
(recur ^{:name "take it!"} (async-dbg/<!! c)))))))
The code above produces the following before hanging: --> 0
--> 1
--> 2
https://pasteboard.co/L4WjXavcFKaM.pngIn this test case, everything sits nicely within the same let statement, but these puts and reads to the same channel could be in different source files, making the bug hard to track.
Once the bug is corrected the sequence diagram should look like this: