noflo assumes all control ports are populated before non-control ports when triggering process function
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.
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().
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?
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.
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.
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
Mea culpa, I forgot that control ports in NoFlo don't fire. Then, indeed, it makes sense to do what @bergie suggested.