Skip to content
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

noflo assumes all control ports are populated before non-control ports when triggering process function #607

Open
sfescape opened this issue Jul 30, 2018 · 6 comments

Comments

@sfescape
Copy link

With a component such as:

component.Inport.add("in", {
datatype: "all"
})
component.Inport.add("ctl", {
datatype: "object",
control: true,
required: true
})

If you receive more then one packet at "in" before you receive any packet at "ctl" then once a "ctl" packet is received the process method is only triggered once, leaving the "in" buffer with unprocessed packets.

@trustmaster
Copy link
Member

That's actually expected behaviour. In order to get all packets from the buffer you need to use input.hasStream() and input.getStream(), or a loop over items using input.has() and input.get().

@sfescape
Copy link
Author

sfescape commented Nov 2, 2018

Why would that be expected behavior? It only occurs in the case of control packets, and means your component has to be aware that there are control packets. What benefit does that have?

@trustmaster
Copy link
Member

There is no benefit, it's a design tradeoff. Firing patterns in FBP are not always easy. There might be a corner case like this, and components have to take it in consideration.

@sfescape
Copy link
Author

sfescape commented Nov 3, 2018

I don't see what the design tradeoff is. Having a component randomly fail to process all messages because of a race condition certainly seems like a defect to me, not a tradeoff.

@bergie
Copy link
Member

bergie commented Nov 3, 2018

The thing is, control ports are non-firing (by design). But indeed, I agree that there should be the exception that they probably should fire if there is unprocessed input in the other ports

@trustmaster
Copy link
Member

Mea culpa, I forgot that control ports in NoFlo don't fire. Then, indeed, it makes sense to do what @bergie suggested.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants