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

1.2.4 Version #64

Merged
merged 13 commits into from
Jul 4, 2022
Merged

1.2.4 Version #64

merged 13 commits into from
Jul 4, 2022

Conversation

dinesharjani
Copy link
Contributor

What we wanted to fix is the 'Missed ACK' issue which was just 'silenced' before. Now we think we have a proper / logic-level fix, but unfortunately, it looks like our zealous attempt at implementing 'fast timeout' like Android has, might've broken more things. At least that's what our constant back-and-forth which changes show, fast timeout was maybe 'too fast' under our testing, and it worked for periods of time when additional debugging code slowed it down.

This will allow us to track the expected offset for each Sequence Number received, since we're sometimes getting them out-of-order.
…w always set from the upload() function

This means the logic is all condensed in one place. Also, it's less code, and less repeated calls to the same function everywhere when the logic was here in the first place.
The root cause were Responses being received out-of-order than what we expected. The fix was to track which is the offset we expect for each packet sent, represented by the Sequence Number. But instead of doing it all in a single commit, we went the multiple-commit approach for a better insight into the changes.
Previously, if during Upload a package was not delivered, it'd stall the UI for up to 30 seconds (standard timeout) and then fail. Now, we detect the 'write timeout' case and retry with a much shorter duration, allowing for cases wherein a couple of missed writes / packages don't cause the entire process to fail.
The first packet send takes longer to be received because the firmware device is usually busy. Also, we allowed more time for the 'fast timeout' in case the device firmware can't keep up.
We want timeouts to be retried when they fail fast, not when they take a long time. If the device takes 30s to reply back, it's likely it won't reply after a further 60 seconds, so McuMgrBleTransport has added logic to differentiate this with a new 'fast timeout' threshold set to 10 seconds.
Perhaps our previous issues were due to the Pipelining system attempting to send too much Data before the Device could absorb it. So now, if we receive a Packet OOD, we wait until the next one we receive is the one we expect, unless the Pipeline is completely empty. From my logging attempts, this doesn't seem to happen - it's mostly a single Packet that is received OOD from time to time.
DFU is still not performing like I expected it to.
… called under thread-safe conditions

This line doesn't hurt. It's only present to aid my own sanity.
We found the 5-second limit caused a DFU update to the Matter Weather Station to fail, to the point where I'm considering to remove this code. But, I know the Android side does this, so we should keep it and see if we get real world issues.
I think offset == 0 was not correct. Don't know why it shouldn't be, but then, there are so many things that don't make sense here...
Uploads look a lot more stable without 'Fast Timeout'. We can fix this later whenever we decide to come back to it.
@dinesharjani dinesharjani self-assigned this Jul 4, 2022
@dinesharjani dinesharjani merged commit 6426e06 into master Jul 4, 2022
@dinesharjani dinesharjani deleted the out-of-order-write-response branch July 4, 2022 15:32
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

Successfully merging this pull request may close these issues.

1 participant