-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Unit test for lost CRMP ack messages #7291
Conversation
@@ -95,6 +95,10 @@ class MockAppDelegate : public ExchangeDelegate | |||
System::PacketBufferHandle && buffer) override | |||
{ | |||
IsOnMessageReceivedCalled = true; | |||
if (mDropAckResponse) | |||
{ | |||
ec->GetReliableMessageContext()->SetAckPending(false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not clear to me why this is enough. ReliableMessageContext has three functions keeping track of acks:
HasPeerRequestedAck()
IsAckPending()
GetPendingPeerAckId()
For standalone acks, it looks like HasAckPending()
is used. For piggybacked acks, HasPeerRequestedAck()
is checked. I guess in this case there is no actual response so the piggybacking does not come in? But it's still not clear to me why HasPeerRequestedAck()
even exists and why its use in ExchangeMessageDispatch::SendMessage
is correct (instead of testing IsAckPending()
there).
In particular, once HasPeerRequestedAck()
starts testing true it never goes back to false afaict... That seems pretty dubious.
If none of that has to do with this PR, please just let me know and I'll file a followup.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think a follow up will be useful for HasPeerRequestedAck
. This test is relying on standalone ack.
My thinking is that, if it's a piggyback ack, the sender of ack will probably request an ack as well (for the message on which ack is being piggybacked). So, if the ack is lost, so is the message on which it was piggybacked. And, that might trigger a retransmit from the ack sender. The overall test case might be trickier, but still doable. Need more analysis if the missing piggybacked ack itself can cause this kind of a deadlock.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Filed #7339 on my comments above.
- Enable test for lost CRMP ack messagesconnectedhomeip/src/messaging/tests/TestReliableMessageProtocol.cpp Lines 560 to 570 in 0adb96d
This comment was generated by todo based on a
|
rebased |
* Unit test for lost CRMP ack messages * disable the check in the test for time being
Problem
Need a test where the ack to a received message is dropped. It's expected that message reliability protocol will kick in, and do retransmits until it gets an ack from the receiver (or the retransmit count is exhausted).
Change overview
This PR adds a test where 2 ack messages are dropped. It's expected that the 2nd retry (1 original + 2 retry) will cause the ack to be received by the sender.
However, this test uncovered an issue. The test is currently failing with the following logs.
The issue seems to be related to message counter check.
The code above return failure for the retransmitted message, as it considers it as a duplicate message.
Testing
CheckResendApplicationMessageWithLostAcks
unit test is supposed to test this condition.