-
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
Fix double-free bugs on failure to send a write message. #13051
Fix double-free bugs on failure to send a write message. #13051
Conversation
There were two separate bugs here: 1) For a group write, we were violating the contract for WriteClient::SendWriteRequest, which is that the caller must call Shutdown on failure but the WriteClient itself will do it on success (and call OnDone in the process). We were unconditionally calling Shutdown and OnDone inside SetWriteRequest, even on failure. 2) WriteInteraction was violating the contract for WriteClientHandle::SendWriteRequest, which is different: it always guarantees it will call OnDone. But the consumer was assuming that OnDone would only be called if SendWriteRequest returned success.
PR #13051: Size comparison from 89aff25 to 6b8aef9 Increases (14 builds for esp32, k32w, mbed, nrfconnect, qpg, telink)
Full report (32 builds for efr32, esp32, k32w, linux, mbed, nrfconnect, p6, qpg, telink)
|
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.
Please hold off merging this PR - I'd very much like to review this properly tomorrow morning since I'm going to putting out PRs in this space very soon too.
fast track: small delta, several checkmarks, PR up for sufficient time for cross timezone review. |
There were two separate bugs here:
For a group write, we were violating the contract for
WriteClient::SendWriteRequest, which is that the caller must call
Shutdown on failure but the WriteClient itself will do it on success
(and call OnDone in the process). We were unconditionally calling
Shutdown and OnDone inside SetWriteRequest, even on failure.
WriteInteraction was violating the contract for
WriteClientHandle::SendWriteRequest, which is different: it always
guarantees it will call OnDone. But the consumer was assuming that
OnDone would only be called if SendWriteRequest returned success.
Problem
See above.
Change overview
See above.
Testing
Manually tried running the TestGroupMessaging yaml test on darwin. It fails to send the messages (for now) and that was triggering the double-frees. With these fixes those double-frees are gone.