-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Infinite loop -> OOM in SampleBuilder edge case #1810
Comments
Nice catch @kcking ! Sorry about hitting this bug @robin-raymond you have the bandwidth to look into this? If not I can grab? @kcking if you are interested in contributing a unit test that fails would be a really great first contribution. Would love to work together on this. Would be nice if @robin-raymond has a quick fix, but if not this could be ours to take. |
I will take a look. |
Hi @kcking and @robin-raymond. Thank you for your contributions! I believe I ran across the same issue. The program panics on line 246 with an "out of memory" error occasionally.
webrtc Version: v3.0.29 Here is the trace if you are interested: `
|
Ok, I understand what's happening. Active becomes "empty" after consuming the packets, but instead of the "filled" getting purged by "purgeConsumedBuffers", it doesn't because active is now empty and empty buffers cannot cause any purging. So the solution is to purge the "consumed" area first, then "active". That will resolve the issue. I'm going to link a PR to give this a test if you like since you've been hitting this issue. |
@danj565 You might want to check if your issue is related or not. I'm uncertain how it would cause memory overflow, unless the infinite loop causes a backlog in the builder which indirectly causes it. |
@robin-raymond Thanks again for your contribution. I will replicate and report back if I hit the OOM issue again. |
I can confirm the samplebuilder fix works in production! Thanks again @robin-raymond .. @Sean-Der I noticed this was not apart of any release. Let me know what I can do to help. Thank you for the great library! |
Hey @danj565 thanks for using it :) Mind if I add you to the Pion organization? You can push a new minor tag whenever you like The only restriction we have is that pushing to master requires PR + one review. We really need more contributors/more maintainers so your help would be highly appreciated :) |
@Sean-Der sorry for the delayed response. I would love to contribute. Please add me to the organization. |
@danj565 done! |
If the s.buildSample call inside of purgeBuffers happens to find a complete packet, s.active is updated to s.consume.tail
webrtc/pkg/media/samplebuilder/samplebuilder.go
Line 227 in d625f6f
continue
toreturn
which seems to fix this behavior for me, but there might be a more correct solutionYour environment.
What did you do?
Saw this issue in SampleBuilder used in ion-avp connected to ion-sfu, caused by a vp8 stream sent from chrome specifically when some minor packet reordering occurred.
What did you expect?
Reconstruct packets even with reordering
What happened?
Infinite loop + OOM
The text was updated successfully, but these errors were encountered: