I got a libasan log (you can find it here)
It’s either me doing something wrong or it’s an actual leak
I got a libasan log (you can find it here)
It’s either me doing something wrong or it’s an actual leak
That depends on what you’re doing, which version you’re using and how you’re using the API. To validate leaks at shutdown, you should ensure that all sessions are properly closed before closing Janus too.
Version is from 4419baf07a8dfe462346bbb67a51da6504596f84 commit, but regarding the usage of the API - have to check because it’s handled by a big application, so will check. And regarding sessions - I waited till all handles disappear in Admin demo attached to the server
In general, if it’s a refcounting problem (it looks like your line points to a subscriber instance), then you can uncomment this line and recompile. It will add a ton of log lines to the log, but it will keep track of all references we create, and how they go up and down. When shutting down Janus, it will tell you which ones are still there, and so you can traverse the log to see why it didn’t get back to 0.
By the way, is it intentionally that in janus_videoroom.c:10313 we call janus_refcount_init and right on the next line we call janus_refcount_increase? (Didn’t dig deep in code yet, but in other places all increase have a comment)
I’ll enable refcount debug, collect logs and come back later (it will definitely take some time)
Here are some cases from the logs gist:5bdf4752541b77e64c0948ea27dec92e · GitHub
It seems that it’s some kind of mismatch on some api calls. Will come later after looking deeper.
So, tried to unsubscribe from all streams, but still have a leak.
We record all tracks, it might affect somehow.
Anyway it’s a bit suspicious that even after session and room destroy there are still some non-zero reference counters.
The most suspicious code is in lines 9499-10562. The code handles a lot of errors there and decrements the counters. So maybe some counter isn’t decrementing there.
Since we have a leak sanitizer trace and confirmed the leak with refcount, we should move the discussion on GitHub in an Issue.
Please try to repeat your steps on a fresh master commit and share:
UPD
Fixed in latest master!