-
Notifications
You must be signed in to change notification settings - Fork 107
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Stream pipeline correctly connected by take! hangs #147
Comments
I just tried to reproduce your issue based on your description: > (def a (s/stream))
> (def b (s/stream))
> (def c (s/stream))
> (s/put-all! a [1 2 3])
<< … >>
> (s/connect a b)
nil
> (s/connect b c)
nil
> (->> c s/stream->seq (take 3))
(1 2 3) This seems to work as expected. Can you expand on how my example differs from what you're doing? |
Thanks for the quick response. Some friend in clojurians pointed out to me that once I connected several streams together. I only can consume messages from the final output. So in my example I only can consume from C's output which works just fine. |
Hey, I was the one who answered the question. @lxsameer - would be interesting to hear how you thought the streams worked and what your initial design was based on your mental model. Probably you aren't the only one making the same assumptions. Will be easier to clarify the documentation after we clear this up. |
I read the docs on aleph.io many times and my assumption was that when you connect a series of streams to each other, you still can inspect each stream along the way. For example if I connect A -> B -> C. Then by putting some value in A I should be able to take that from B as well without effecting the pipeline ( I still should be able to get it from C too ). Because in my use case I connect the components input and output based on a workflow graph dynamically. |
If you If things did work this way, then each stream in your software would effectively hold onto every message forever, eventually leading to a memory leak. This happens fairly often with large lazy sequences, where you mistakenly hold onto the head of the sequence. This is why Manifold mimics the semantics of |
Hi
First of all kudos.
I have several components which everyone of them has an input stream and an output stream.
I connected my input and output of components like:
input of component A connected to output of component A.
output of component A connected to input of component B.
input of B connected to output of B
output of B connected to input of C
and finally input of C connected to output of C.
I confirmed this by walking the pipeline using
downstream
function. here is the output of the walk:But the problem is that when I
put!
something in any of these streams, andtry-take!
the value in either the stream itself or the downstream,take!
hangs out andtry-take!
returns the timeout value. But theput!
return value derefs totrue
.My component functions are fairly simple:
If i remove the call to
connect
function in the function ( not create a pipeline ) I can take a value from the same stream which i put the value in.NOTE: I tried to debug this issue in latest manifold version. I found out that the
producers
in https://github.com/ztellman/manifold/blob/master/src/manifold/stream/default.clj#L204 is empty for the downstream stream. My guess is thatput
method of stream returns true but it does not actually put the value in theproducers
. But i didn't confirm this guess.The text was updated successfully, but these errors were encountered: