Client subscription ack mechanism might raise an assertion failure
Description
In some cases the following assertion is raised when using subscription with monitored items in creation:
(commit 7032c864) src/ClientServer/frontend/client_wrapper/state_machine.c:1377: SOPC_ASSERT(!pSM->bAckSubscr);
Analysis
The client is not expecting receiving 2 PublishResponses with available SN to acknowledge without sending a PublishRequest with 1 acknowledgement between those two received messages. Since we should send back a PublishRequest after treating any response message received when the number of Publish token is not reached it seems reasonable. But we are filtering the state machine state for session activated state only whereas at least the state create monitored item should be accepted too.
On the acknowledgment mechanism itself we should note that we acknowledge the available SN and not the received ones which is only interesting to avoid the server to keep them for republish since we do not manage it yet. It should be reworked to acknowledge received SN instead when the enhancements identified in #1201 will be implemented.
Implementation
- Remove the assertion since due to the states filtering we should not consider it as a fact and there is no critical consequence since we will continue to acknowledge available SNs. In worst case scenario some SNs might not be acknowledged which should be manageable by the server.
- Do a better filtering of state machines states for which a PublishRequest might be sent, at least add the create monitored items state.