core.async

Mult gets stuck when you put a value on the source chan and there are no taps on the first tick

Details

  • Type: Defect Defect
  • Status: Resolved Resolved
  • Priority: Major Major
  • Resolution: Completed
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: None
  • Labels:
    None
  • Environment:
    ClojureScript
  • 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.

Activity

Hide
Radford Smith added a comment -

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

Show
Radford Smith added a comment - 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
Hide
Leon Grapenthin added a comment -

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?

Show
Leon Grapenthin added a comment - 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?
Hide
Radford Smith added a comment - - edited

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

Show
Radford Smith added a comment - - edited I attached the patch that was originally in the pull request.
Radford Smith made changes -
Field Original Value New Value
Attachment 0001-ASYNC-41-Make-mult-drop-values-when-there-are-no-tap.patch [ 12503 ]
Hide
David Nolen added a comment -

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

Show
David Nolen added a comment - Thanks for the patch. Radford have you submitted your CA, it's required in order for us to merge patches in. Thanks!
Hide
Ghadi Shayban added a comment - - edited

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

Show
Ghadi Shayban added a comment - - edited Sorry I missed this discussion. I copy ported 3f98 to master, Rich's original fix from the CLJ side of the project.
Hide
Timothy Baldridge added a comment -

Fixed by Ghadi

Show
Timothy Baldridge added a comment - Fixed by Ghadi
Timothy Baldridge made changes -
Resolution Completed [ 1 ]
Assignee Rich Hickey [ richhickey ] Timothy Baldridge [ halgari ]
Status Open [ 1 ] Resolved [ 5 ]

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: