trustmaster/goflow

Component with multiple inputs not stopped

lovromazgon opened this issue · 4 comments

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?

I see that seanward already fixed this issue in #28.
@trustmaster can I kindly ask you to merge it?

@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.

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.

Closing as not relevant for master branch