<< Back to previous view

[ASYNC-145] mix throws assertion error when many channels are added to a mix. Created: 08/Sep/15  Updated: 14/Feb/17

Status: Open
Project: core.async
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Defect Priority: Minor
Reporter: Angus Fletcher Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: mix
Environment:

Found in core.async version 0.1.346.0-17112a-alpha


Attachments: Text File 0001-Change-channel-to-sliding-buffer-090815.patch     Text File 0001-Change-channel-to-sliding-buffer.patch    
Patch: Code

 Description   

When a large number of channels is added to a mix simultaneously, this error is thrown:

java.lang.AssertionError: Assert failed: No more than 1024 pending puts are allowed on a single channel. Consider using a windowed buffer.

We can reproduce the issue with the following in a REPL:

user> (require '[clojure.core.async :as a])
nil
user> (defn mixtest []
(let [out (a/chan 1024)
mix (a/mix out)]
(dotimes [i 2048]
(let [chan (a/chan)]
(a/admix mix chan)
(a/put! chan i)))))

(mixtest)
#'user/mixtestAssertionError Assert failed: No more than 1024 pending puts are allowed on a single channel. Consider using a windowed buffer.
(< (.size puts) impl/MAX-QUEUE-SIZE) clojure.core.async.impl.channels.ManyToManyChannel (channels.clj:150)
user>

This is a consequence of the use of an unbuffered channel in the mix implementation. Since the channel's function is just to update the mix's internal data structure, using a windowed buffered channel appears to clear up this issue. Patch 0001-Change-channel-to-sliding-buffer.patch contains the proposed solution.



 Comments   
Comment by Angus Fletcher [ 08/Sep/15 2:32 PM ]

Update patch to include cljs fix as well.





[ASYNC-69] How to better communicate "mix" lifecycle wrt coordination Created: 09/May/14  Updated: 13/Feb/17

Status: Open
Project: core.async
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Enhancement Priority: Minor
Reporter: Timothy Baldridge Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: mix

Approval: Vetted

 Description   

Confusion regarding 'mix' lifecycle. Users have a false expectation that a mix's output should magically close when its source channels close, not realizing its a dynamic coordination process. Actually ensuring correctness when using mult/mix/pub isn't so straightforward, people need to control consistency from the producer end, and not ad hoc from the consumer side (e.g. late taps of a mult).






[ASYNC-39] Processes spawned by mix never terminate Created: 21/Nov/13  Updated: 05/May/14

Status: Open
Project: core.async
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Defect Priority: Minor
Reporter: Leon Grapenthin Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: chan, mix
Environment:

"0.1.256.0-1bf8cf-alpha"



 Description   

Once a mix has been created, the go-loop inside mix will always recur. Obviously, input-channels can be unmixed and the output-channel could be closed, but the process would still never terminate.

Probably mixes should support something like (stop) to to make the mix-associated process garbage-collectable. Operations on a stopped mix should probably throw.



 Comments   
Comment by Ghadi Shayban [ 22/Apr/14 10:44 AM ]

On 0.1.278 the mix process terminates when its output channel closes [1].

[1] https://github.com/clojure/core.async/blob/master/src/main/clojure/clojure/core/async.clj#L778

Comment by Leon Grapenthin [ 24/Apr/14 3:16 AM ]

Yes, it has been fixed using the new return behavior of put!. (I can't find an option to close this issue)





Generated at Thu Mar 23 21:35:14 CDT 2017 using JIRA 4.4#649-r158309.