bitfocus / companion-module-obs-studio

OBS Studio Module for Companion
MIT License
41 stars 28 forks source link

Won't stay connected #235

Closed SWCMedia closed 12 months ago

SWCMedia commented 1 year ago

OBS module connects then disconnects. Cycle repeats forever.

Companion error: starts with error: /Applications/Companion.app/Contents/Resources/bundled-modules/obs-studio/main.js:2 Complete Companion log file is attached.

OBS error: [obs-websocket] [WebSocketServer::onClose] WebSocket client[::ffff:192.168.18.130]:49462has disconnected with code1006and reason: End of File Complete OBS log file attached.

Version Information:

Companion-OBS Error Log.txt OBS Log 2023-07-04 15-37-16.txt

bryce-seifert commented 1 year ago

@SWCMedia Would you be able to use the Export Support Bundle from Companion log page right after the error occurs and send that over?

It might also be worth updating to OBS 29.1.3 and seeing if this persists. There is a note in the changelog for 29.1.3 regarding a potential web sockets crash being fixed.

SWCMedia commented 1 year ago

@bryce-seifert Thanks for taking a look. Support Bundle attached. Let me know if you would like to see anything else.

Running OBS 29.1.3 does not resolve the issue. SWC-BCAST.local_companion-config_20230705-1405.zip

bryce-seifert commented 1 year ago

@SWCMedia Thanks for providing that. Unfortunately I didn't see anything revealing there.

Would you be able to open the Log icon for the obs-module, and see if any errors are present in that log?

Screenshot 2023-07-05 at 8 45 00 PM
SWCMedia commented 1 year ago

Hi @bryce-seifert . Yes, that was one of the files I uploaded in the original post: https://github.com/bitfocus/companion-module-obs-studio/files/11952596/Companion-OBS.Error.Log.txt.

There are a number of errors in there. Seem related to the main.js function. FWIW, the problem existed as well with Companion v2.4.2/OBS Module v2.5

I'd be glad to run that again if it helps.

bryce-seifert commented 1 year ago

@SWCMedia Got it, sorry I thought that was the main companion log. Because of how it’s compressed and packaged in companion I’m not getting a ton of helpful info from that main.js error unfortunately. I’m going to try and create a package with more logging for you to test, in hopes I can narrow it down a bit.

bryce-seifert commented 1 year ago

@SWCMedia I have a build of the OBS module with more logging enabled.

Are you familiar with loading custom modules in v3.0?

If so you can use this package, and let me know if any more errors are visible in the log. If you need help loading the module let me know. pkg.tgz

SWCMedia commented 1 year ago

@bryce-seifert Thanks very much. I've not loaded custom modules into v3, but I'l figure it out.

I was also working on the issue and found that if I zip the OBS config file from ~/Library/Application\ Support/obs-studio and replace it with the config files from the same directory from another machine, then the problem goes away. Restoring the original config causes the problem to return.

So it very much seems that something in the configuration is damaged. Though how to isolate it further is something I would appreciate help with.

Regardless, I'll install the custom version and report back.

bryce-seifert commented 1 year ago

@SWCMedia That is really interesting.If you're able to share the compressed config I could also give it a run on my machine and see if I can replicate.

And for the custom module, if you click the gear icon and then select a folder with the unpackaged .tgz file, it should load it up.

Screenshot 2023-07-07 at 4 48 12 PM
SWCMedia commented 1 year ago

Ahh. That's pretty simple 😄! Here I was poking about inside the app bundle.

Attached is the config that doesn't exhibit the problem.

BUWorkingConfig.zip

SWCMedia commented 1 year ago

@bryce-seifert New log files attached.

companion-config_20230707-1642.zip companion_log_20230707-1642.csv

SWCMedia commented 1 year ago

@bryce-seifert Thought in would be useful to post the log files from the original OBS config folder that cause the problem. The file .../logs/2023-07-02 10-29-51.txt has numerous entries like:

10:30:15.090: [obs-websocket] [WebSocketServer::onMessage] Sending message to client failed: invalid state

10:30:15.404: [obs-websocket] [WebSocketServer::onClose] WebSocket client `[::ffff:192.168.18.130]:49195` has disconnected with code `1006` and reason: End of File`

10:30:16.009: [obs-websocket] [WebSocketServer::onMessage] Sending message to client failed: Bad Connection

Seems if we could figure out what originates those we'd be well open the way to remediate...

Be glad to post anything else from the ops-studio directory that helps. (Too large a zip file for the 25MB GitHub limit.)

logs.zip

bryce-seifert commented 12 months ago

@SWCMedia I agree that diagnosing what's causing that will be helpful.

Would you be able to upload the non-working obs config that causes that message? So the broken cofig, to Dropbox at this request link. That way I can launch it on my machine and see if I can get the same error. Thank you!

SWCMedia commented 12 months ago

@bryce-seifert Full config uploaded.

Thanks again for taking the time to look into this.

bryce-seifert commented 12 months ago

@SWCMedia Thanks for sending the config. I was able to recreate the issue. I tried a lot of things with companion and websocket, but couldn't find an obvious cause.

However, I did notice it seems like the Scene file in Basic > Scenes is pretty large (152MB), even VScode crashes when trying to open it. However if I open an OBS dialog and save, it seems to shrink the size down to a more reasonable ~42KB.

I have a config uploaded here, would you be able to download it and see if the issue still persists?

FixedConfig.zip

SWCMedia commented 12 months ago

@bryce-seifert All right! Tried the FixedConfig on my home system and the issue seems to be fixed as well! I'll give it a whirl on the live system tomorrow & let you know how that goes. Truly can't thank-you enough for everything to date.

Question — "if I open an OBS dialog and save...". Could you elaborate on what/how you did this?

bryce-seifert commented 12 months ago

@SWCMedia Good question. By that I mean, if I opened up the Settings for a source and then clicked OK, I would get this dialogue box

Screenshot 2023-07-13 at 4 25 07 PM

After clicking save there, it seems to save over the corrupt scenes JSON file in the settings folder.

SWCMedia commented 12 months ago

@bryce-seifert Ah! Very interesting.

Confirming that the "FixedConfig" did indeed fix the issue on the production machine.

It appears that the root issue was/is the "Move" plug-in.

The FixedConfig removed the transitions set up using the Move plugin. Which is OK, as I can now tinker and see if that is in fact the cause. My guess is OBS was so busy trying to parse the broken config file that it ran out of cycles to process the WebSockets connects. Seem plausible?

Regardless, can't thank-you enough for taking the time to resolve the issue. Very much appreciated.

bryce-seifert commented 12 months ago

@SWCMedia No problem! Happy to help any time. Yeah whatever it was, it seems like trying to read the large file led to the failure. Let me know if you need anything else!