FYI: OBS Crashes During 3rd Party App Usage (My App), Investigation, Solution

bcoyle

Member
I'm writing a 24/7 scheduling App. During testing, I was getting obs crashes randomly, sometimes many hours after starting. I decided to investigate by putting my program into a loop and trying to cause a crash. I knew in my program where it was stopping by looking at the log. I found that crashes were consistently happening during a obs socket command. See the crash report. The situation was that I was asking vlc or ffmpeg to load a file and quickly sending another command to see if obs was ready (my version of a sync command). With no delay, the crash happened quickly, The loop maybe running a couple hundred times. Putting in different delays, (my computers is a 4 core - hyper threaded to 8, I7,running at 3.4ghz, so fairly fast, running h264 encoding,no gpu acceleration), i found that at 40ms, still crashes but takes longer, at 50ms takes more loops and at 60ms, it would not crash, at least in the time I ran it. So, in the loop, I was sending a set source command following by another command. The 60ms time is obliviously a "TUNED" time based on my computer, and may be different for slower computers? Who knows. The source file was on a costco, 5400rpm drive, so that takes awhile. So if you are using a third party app where it can send commands, hotkeys quickly, you may want to think about delays. Obliviously, if you never have any problems, you are in good shape. This happened in my situation and may not be a general problem, but I thought I would share my experiences hoping that it might be of help to people. Maybe if other people would like to share their experiences and the solutions they found, it might start an interesting conversion.
 

Attachments

  • Crash 2021-08-15 14-47-25.txt
    150 KB · Views: 18

Harold

Active Member
Provide the most recent regular session log as well.

The crash report you provides shows a crash in the websocket plugin
 

bcoyle

Member
Here is the matching log file. You can see that when it is crashing, I'm looping thru a set_source command. The log file doesn't show my triggering command, but you can see what I was doing. Yes, I agree with you, it's easy to see it was a websocket command. Don't know if that it means the websocket plugin has the problem or obs itself.
 

Attachments

  • 2021-08-15 14-45-09.txt
    258 KB · Views: 17

bcoyle

Member
Here is the matching log file. You can see that when it is crashing, I'm looping thru a set_source command. The log file doesn't show my triggering command, but you can see what I was doing. Yes, I agree with you, it's easy to see it was a websocket command. Don't know if that it means the websocket plugin has the problem or obs itself.
A note. The crash always hppened at the same default crash address each time I made it crash
 

bcoyle

Member
There's a joke about doctors. A man goes to a doctor and said, "that when I poke at this sore on my arm, it hurts". The doctor says: "well don't poke it". Maybe, I shouldn't poke at it that fast. LOL. Developers do run into weird problems. but having control over your own code, does allow you to pro-actively investigate your problem, whereas a user that is using some one else's app, doesn't have that option.
 

R1CH

Forum Admin
Developer
The websocket plugin is known to be somewhat unstable under these conditions, it is not entirely thread-safe.
 
Top