trustmaster / goflow

Flow-based and dataflow programming library for Go (golang)
MIT License
1.6k stars 125 forks source link

Component with multiple inputs not stopped #37

Closed lovromazgon closed 4 years ago

lovromazgon commented 7 years ago

I discovered that a component with 2 (or more) input channels is not stopped properly, even though all input channels are closed.

I also created a test in this gist.

In the test I create a simple net:

------
| C1 | \    ------
------  \-> |    |
            | C2 |
------  /-> |    |
| C1 | /    ------
------

After closing both In ports I would expect that the whole net will be stopped, but the C2 component actually keeps on running.

Am I doing something wrong, or is this a bug?

lovromazgon commented 7 years ago

I see that seanward already fixed this issue in https://github.com/trustmaster/goflow/pull/28. @trustmaster can I kindly ask you to merge it?

trustmaster commented 7 years ago

@lovromazgon #28 didn't have tests so I couldn't merge it blindly. I'd be happy to merge the patch if it is rebased on current master and provided a test.

abferm commented 6 years ago

I've been trying to come up with a good solution for this. It relates in a way to #39 because it has to do with the terminate() closure and the way closed channels are handled. The handler loop currently exits when any of the inputs are closed, where I believe it should wait until they are all closed.

trustmaster commented 4 years ago

Closing as not relevant for master branch