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

Add references to publisher's streams when dealing with forwarders #3331

Merged
merged 2 commits into from Feb 27, 2024

Conversation

atoppi
Copy link
Member

@atoppi atoppi commented Feb 16, 2024

We have been notified on the discourse group and on our customers' dedicated platform of a crash occurring in the videoroom plugin when using Janus v1.2.1.
After a deep analysis we concluded that the problem might be due to the freeing of a specific mutex during a hangup request while it is being locked by another request.

Backtraces or logs of the crash might mention

g_mutex_clear() called on uninitialised or locked mutex

or

GLib-CRITICAL **: 15:24:46.902: g_hash_table_iter_next: assertion 'ri->version == ri->hash_table->version' failed
#0 0x7fb24b8a3898 in abort (/lib/x86_64-linux-gnu/libc.so.6+0x28898)
#1 0x7fb24c2d3f62 in g_mutex_clear (/lib/x86_64-linux-gnu/libglib-2.0.so.0+0xa4f62)
#2 0x7fb240150bce in janus_videoroom_publisher_stream_free plugins/janus_videoroom.c:2363

This patch tries to address the discovered problem.

If you are affected by this issue, please test and report.

@RSATom
Copy link
Contributor

RSATom commented Feb 16, 2024

@atoppi I've backported that patch to v1.2.1 and our team installed updated version on our test servers. Unfortunately we got another crash:

#0 0x7fd8e4267685 in __interceptor_pthread_create ../../../../src/libsanitizer/asan/asan_interceptors.cpp:216
#1 0x7fd8e3edc504  (/lib/x86_64-linux-gnu/libglib-2.0.so.0+0xaa504)
SUMMARY: AddressSanitizer: heap-use-after-free plugins/janus_videoroom.c:8087 in janus_videoroom_incoming_rtp_internal
Shadow bytes around the buggy address:
0x0c2c7fffaa80: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
0x0c2c7fffaa90: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
0x0c2c7fffaaa0: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
0x0c2c7fffaab0: fd fd fd fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c2c7fffaac0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
=>0x0c2c7fffaad0: fd fd fd fd[fd]fd fd fd fd fd fd fd fd fd fd fd
0x0c2c7fffaae0: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
0x0c2c7fffaaf0: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
0x0c2c7fffab00: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
0x0c2c7fffab10: fd fd fd fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c2c7fffab20: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
Shadow byte legend (one shadow byte represents 8 application bytes):
Addressable:           00
Partially addressable: 01 02 03 04 05 06 07
Heap left redzone:       fa
Freed heap region:       fd
Stack left redzone:      f1
Stack mid redzone:       f2
Stack right redzone:     f3
Stack after return:      f5
Stack use after scope:   f8
Global redzone:          f9
Global init order:       f6
Poisoned by user:        f7
Container overflow:      fc
Array cookie:            ac
Intra object redzone:    bb
ASan internal:           fe
Left alloca redzone:     ca
Right alloca redzone:    cb
Shadow gap:              cc
==1==ABORTING 

But I don't know if it's related or something different...

@atoppi
Copy link
Member Author

atoppi commented Feb 16, 2024 via email

@lminiero
Copy link
Member

@RSATom please test the exact branch of this PR, at least with respect to the VideoRoom, don't apply your patches to whatever fork you have. We can't (and won't) debug modified code.

@RSATom
Copy link
Contributor

RSATom commented Feb 16, 2024

@atoppi Sorry, forgot to provide reference to sources. it's here: RSATom/janus-gateway/src/plugins/janus_videoroom.c#L8087

@RSATom
Copy link
Contributor

RSATom commented Feb 16, 2024

@lminiero I'm not sure if I can test exact branch since our app relies on other plugins and patches. But there is no changes from our side to Videoroom plugin atm. So, maybe, I can rebase all my patches over this PR and test it that way if it will be acceptable.

@lminiero
Copy link
Member

@RSATom please test the new commit.

@RSATom
Copy link
Contributor

RSATom commented Feb 16, 2024

Thanks! I will test on Monday

@RSATom
Copy link
Contributor

RSATom commented Feb 20, 2024

FYI, we didn't get any crash yesterday, but we plan spend some more days on testing it.

@RSATom
Copy link
Contributor

RSATom commented Feb 26, 2024

FYI, didn't get any crash last week...

@lminiero
Copy link
Member

Thanks for the feedback, merging then!

@lminiero lminiero merged commit 2bfc7f9 into master Feb 27, 2024
8 checks passed
@lminiero lminiero deleted the fix-vr-mutex-clear-crash branch February 27, 2024 11:03
RSATom pushed a commit to RSATom/janus-gateway that referenced this pull request Apr 2, 2024
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.

None yet

3 participants