<< Back to previous view

[ASYNC-41] Mult gets stuck when you put a value on the source chan and there are no taps on the first tick Created: 30/Nov/13  Updated: 12/Dec/13  Resolved: 12/Dec/13

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

Type: Defect Priority: Major
Reporter: Radford Smith Assignee: Timothy Baldridge
Resolution: Completed Votes: 0
Labels: None
Environment:

ClojureScript


Attachments: Text File 0001-ASYNC-41-Make-mult-drop-values-when-there-are-no-tap.patch    
Patch: Code and Test

 Description   

If you have a mult and you put a value on its source channel, but there are no taps at the moment, the mult will get stuck and not put any values on future tap channels. Here's an example: http://cljsfiddle.net/fiddle/rads.mult-bug

In the example, no value will ever get put on the `tap1` chan. There are two possible solutions to this: a) drop all values going to the mult until a tap is created, or b) queue the values until a tap is created. I believe the first option is more straightforward, since if you have 1 tapped channel already and you go to 2 taps, the mult does not put old values on the new tap. This would make the behavior consistent going from 0 taps to 1 tap as well.



 Comments   
Comment by Radford Smith [ 30/Nov/13 10:45 PM ]

It looks like dropping values is already the default behavior on the JVM. In fact, this is the only difference in implementation for `mult` between the JVM and CLJS. I created a pull request with the fix and a regression test: https://github.com/clojure/core.async/pull/38

Comment by Leon Grapenthin [ 02/Dec/13 2:21 PM ]

This is similar to http://dev.clojure.org/jira/browse/ASYNC-26 of the CLJ version and has been fixed. Apparently the fix has not yet been ported to the CLJS version?

Comment by Radford Smith [ 02/Dec/13 4:24 PM ]

I attached the patch that was originally in the pull request.

Comment by David Nolen [ 09/Dec/13 12:16 PM ]

Thanks for the patch. Radford have you submitted your CA, it's required in order for us to merge patches in. Thanks!

Comment by Ghadi Shayban [ 09/Dec/13 12:32 PM ]

Sorry I missed this discussion. I copy ported 3f98 to master, Rich's original fix from the CLJ side of the project.

Comment by Timothy Baldridge [ 12/Dec/13 10:34 PM ]

Fixed by Ghadi

Generated at Fri Oct 24 18:22:33 CDT 2014 using JIRA 4.4#649-r158309.