My understanding is this; when the node enters the DYNAMIC_VALUES stage it should query all associated command classes for any dynamic value queries and send these requests. Each time it does it increments the queriesPending counter.

While waiting for the responses to these queries the node should not be advanced to the next stage.  This is the 'if (queriesPending-- > 0)' clause immediately after the block that sends the queries. Each time a response is received for one of these query messages the node will be asked 'advance' but remember that all advancing is done internally to the node class - the stage passed to the advance method is just used for validation.

So as each message arrives back the queriesPending count is checked at the start of the DYNAMIC_VALUES block in the case statement. It will not be -1 so the value is decremented and if there are still pending queries, jumps out again. This keeps happening until all query responses are received.

When the last one arrives, the queriesPending count will drop to zero and the node will be moved to DONE.

Does this make sense? I am not certain I am right, but this is just my understanding of how this process works. And because of this I don't think we should be calling advanceNodeStage artificially.

I think the way the queriesPending counter is being decremented can lead to a little confusion, but I am pretty sure it is working as it should.

So if you two have end points on a node you should see advanceNodeStage() called twice for DYNAMIC_VALUES.

Keen to get this sorted, but difficult for me to test without one of these problematic nodes.