-
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
[ota] Exchange leak #20565
Comments
@Damian-Nordic Where would cancel events "caused by the exchange layer" come from? The current setup for closing exchanges is basically:
In terms of BDX, I believe it always tells exchanges that it plans to respond, so item 3 is not even relevant. So this should all be a local decision in BDX code: you have to null out the exchange pointer under certain conditions.... |
In particular, BDXMessenger is all sorts of broken; starting by fixing that is probably a good idea. I'll take a stab at it. |
For example, if you take a look at
But |
I don't guarantee there are no more places :) |
@Damian-Nordic I believe #20632 should address this..... It's your changes from #20304 plus a fix to BDXDownloader to handle the exchange lifetime correctly. |
Problem
When OTA is cancelled due inactivity timeout, the BDX transfer exchange is leaked. Apart from the possibility to run out of exchanges on constrained devices, it causes a Sleepy End Device never getting back to the idle mode, which may drain the battery.
Same thing may occur in different scenarios, such as passing an error to
BDXDownloader::OnPreparedForDownload
.Proposed Solution
I tried to fix that in a stupid way to close an exchange each time we go back to the idle state, but I wasn't aware of various subtleties of the exchange management and it lead to crashes: #20563.
We need to somehow extend BDX APIs so that we can distinguish cancel events caused by the exchange layer or by external components and close the exchange in the latter cases only.
The text was updated successfully, but these errors were encountered: