Skip to content

Commit 890f96a

Browse files
committed
Fix closing bug in manifold.stream/concat
When `in` is closed and `out` is also closed by the time the chained handler runs, closing `s'` would fail because it's `::none`. This non-deterministic case was occasionally observed with `manifold.stream-test/test-cleanup` failing due to a leaked error deferred like so: WARNING: unconsumed deferred in error state, make sure you're using `catch`. java.lang.ClassCastException: clojure.lang.Keyword cannot be cast to manifold.stream.core.IEventStream at manifold.stream$concat$this__3189__auto____14958$fn__14959$fn__14960.invoke(stream.clj:819) at manifold.deferred$eval3018$chain_SINGLEQUOTE____3039.invoke(deferred.clj:904) at manifold.stream$concat$this__3189__auto____14958$fn__14959.invoke(stream.clj:816) at manifold.stream$concat$this__3189__auto____14958.invoke(stream.clj:815) at clojure.lang.AFn.applyToHelper(AFn.java:154) at clojure.lang.AFn.applyTo(AFn.java:144) at clojure.core$apply.invokeStatic(core.clj:669) at clojure.core$apply.invoke(core.clj:662) at manifold.stream$concat$this__3189__auto____14958$fn__14984.invoke(stream.clj:815)
1 parent 2f10049 commit 890f96a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/manifold/stream.clj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -816,14 +816,14 @@
816816
(d/chain' (take! in ::none)
817817
(fn [s']
818818
(cond
819-
(closed? out)
820-
(close! s')
821-
822819
(identical? ::none s')
823820
(do
824821
(close! out)
825822
s')
826823

824+
(closed? out)
825+
(close! s')
826+
827827
:else
828828
(d/loop []
829829
(d/chain' (take! s' ::none)

0 commit comments

Comments
 (0)