Bug Report OBS disconnects from Twitch when pressing "stop recording"

I am streaming to twitch while starting / stopping local recordings as smaller segments to put on YouTube later. Recently OBS has started disconnecting from twitch though and hanging on "stopping recording" when I press stop recording some amount of the time (not every time though - making this hard to debug).

Here is a screenshot - the button is hung showing "stopping recording..." and my bandwidth drops to 0 even though my computer is still connected to the Internet just fine (games stay going, nothing else drops out):


Log File: https://obsproject.com/logs/i7YQgjVaUahlMoLQ

I have had this hang happen while using the same encoder for my recording as the stream as well as when I try using x264 for the recording, while using nvenc for the stream.

I posted this question in the discord as well, but no one there had any idea why this might be happening. Please let me know if I can provide any further information to help debug this.
Is there an official bounty board for OBS bugs? I'd be willing to put one up for anyone that can get me a patch to correct this issue. Not being able to record local files makes me do more work every day and I'd really like to be able to do it again.



Two things come to my mind:

1. Does it happen when you are just recording too, or only when you have a streaming session running?
2. Does the behavior change when you select a different recording file format?
Well - the issue is that my stream disconnects so I can't really have that be an issue if I am just recording right?

I'll try changing to a format other than flv for the local file. Haven't tried that.


I ask because my assumption is that for some reason the file closing deadlocks. That deadlock will probably cause the stream to stop as a side effect. Because ultimately they share the same generated source - and with limit buffer queues it can be a possible that if there is a bug on one side the other one will fail as a consequence.

If it could be replicated so one could look at a stack trace that would very helpful. Therefore the question if it can be pinpointed to something specific. E.g. if it happens with just recording (e.g. does it just hang there as well for example).
I'll try and do some offline recordings off and on to see if I can get it to deadlock. How can I get debug information when it does deadlock on me? It doesn't happen all the time so I wanna make sure I capture something useful if it does.


Here a bit a debugging is needed. Unfortunately that is not super trivial..

Once it locked up you can attach the debugger GDB to is via `gdb -p <process_id>` and once you are debbuging the process typing `bt` may give us a trace of specific thread where it _may_ be blocking. However there will be multiple threads and it can be possible that the default one is not the one of the most interest. So you would have to switch between them, look at the back-traces of each of them and evaluate their usefulness for the issue. This gets easier if you have some experience.. but if there is something like "stop recording" to be found it may be a good hint.

It would be even better to trigger and analyze this with a debug version of OBS, but that would require building OBS yourself. And then it is not guaranteed that error still triggers since the performance of the application will be worse. And since this bug may be timing related and the timings are now completely different you may never hit the problematic case.

If you find out a way to reproducible trigger the error then I guess any developer should hopefully be able to trigger it - which would be the easiest and most convenient.