Closed ibc closed 7 months ago
CC @gkrol-katmai @pnts-se
The code looks good to me! I think we now have a good grasp of what's going on. I know that adding the 'reset' in that function will fix the leak. I haven't tested this PR.
Not sure what the coding standards are for comments, but I would suggest we add comments to onSslBioOut and DtlsTransport::SendDtlsData (above the implementation). Those should describe the effect of the function and when/why it gets called. Preferably /** */
style. We're doing some subtle things here so we need to be extra clear.
I know that adding the 'reset' in that function will fix the leak. I haven't tested this PR.
I think this is also proven here https://github.com/versatica/mediasoup/issues/1340#issuecomment-1966393672 where it's clear that the onSslBioOut
is always called with len
matching the previous mem_write()
call.
Not sure what the coding standards are for comments, but I would suggest we add comments to
onSslBioOut
andDtlsTransport::SendDtlsData
(above the implementation). Those should describe the effect of the function and when/why it gets called. Preferably/** */
style. We're doing some subtle things here so we need to be extra clear.
Done here: https://github.com/versatica/mediasoup/pull/1345/commits/e827248427956f53c442ae1a930700f213d9edb4
BTW I've added some logs and Wireshark capture in the PR description above proving that everything makes sense.
Let's merge and release. Thanks a lot.
Details
This PR is the same as PR #1156. However that PR introduced a memory leak (see issue #1340). This PR fixes that leak by following the discussion and research in associated issues and PRs, specially here: https://github.com/versatica/mediasoup/issues/1340#issuecomment-1965375082
To prove that this PR works at DTLS level, here the DTLS messages sent from mediasoup to browser while doing the DTLS handshake:
which clearly corresponds to what we see in Wireshark (there is a huge certificate so it's splitted into N DTLS Certificate fragments):
Note that sizes of each message match the DTLS data sent by mediasoup plus UDP and IP encapsulation (32 bytes always).