SceneSwitcher icon indicating copy to clipboard operation
SceneSwitcher copied to clipboard

The Twitch connection stops working after 2-3 hours

Open padreputativo opened this issue 11 months ago • 12 comments

Operating System Info

Other

Other OS

openSUSE

OBS Studio Version

30.2.3

Advanced Scene Switcher Version

1.28.0

Plugin settings

No response

OBS Studio Log URL

https://obsproject.com/logs/rDFzEEhOcNWgn9tK

OBS Studio Crash Log URL

No response

Expected Behavior

The Twitch connection should be balanced for its API limits.

Current Behavior

The Twitch connection drops after several hours of streaming but works again if you close and reopen OBS. However, if you restart Advanced Scene Switcher, normal functionality is not restored.

Steps to Reproduce

  1. Start streaming
  2. Wait two or three hours
  3. Request a reward trigger on the Twitch channel.

Anything else we should know?

I tried restarting the connection with the API, but it doesn’t seem to fix the problem either. It only gets fixed if you close and reopen OBS.

--- removed the link to your settings as they contained your twitch api token ---

padreputativo avatar Feb 05 '25 19:02 padreputativo

It seems like you the connection to the Twitch API suddenly dropped unexpectedly: 19:12:07.627: [adv-ss] Twitch EventSub connection closed: stream truncated

Afterwards the Twitch servers decided to throttle your API access, which had the side effect that the connection to the Twitch event API could no longer be re-established:

...
19:12:31.129: [adv-ss] spent 2512 ms in twitch condition check of macro 'Gay'!
19:12:31.971: [adv-ss] spent 827 ms in twitch condition check of macro 'Aleluya'!
19:12:32.404: [adv-ss] spent 432 ms in twitch condition check of macro 'Pollas'!
19:12:32.793: [adv-ss] Twitch EventSub connection closed: The closing handshake timed out

At the moment I can't really think of a concrete reason why that would be the case. Do you happen to use any other tools which also use the Twitch API at the same time? If not, I might have to re-evaluate how I handle the reconnection to the Twitch event API.

And sorry for being so extremely slow to respond!

WarmUpTill avatar Feb 24 '25 19:02 WarmUpTill

I just disabled all possible extensions and plugins, but I need to keep SpeechChat and Advanced Scene Switcher enabled at the same time. I don't know if that will be enough. Ideally, it would be possible to configure the API access frequency (if that's even possible because I don't know if it's a reverse API that connects to you when you subscribe).

padreputativo avatar Feb 24 '25 20:02 padreputativo

I forgot to mention that if I close OBS and reopen it, it starts working again.

padreputativo avatar Feb 24 '25 21:02 padreputativo

I just discovered something else. NVIDIA (or KDE + NVIDIA) blocks access to the GPU in certain cases, preventing videos from playing. That could cause a timeout or something similar and cut the connection to Twitch. If I disable hardware acceleration, then it works.

padreputativo avatar Feb 25 '25 20:02 padreputativo

I have disabled the KDE option that allows programs to lock the GPU, and I no longer have issues in games like I did before, so I understand that this is not what is causing the problem. Can't the API access frequency be adjusted?

padreputativo avatar Mar 04 '25 18:03 padreputativo

I verify that the connection is lost and it tries to reconnect (perhaps too soon) without success. However, if I close OBS and reopen it, it works. If I disable Advanced Scene Switcher, it keeps trying to reconnect even if I turn it off. Maybe there should be a button to stop the connection because reconnecting doesn't have any effect either. And the GPU issue is not affecting the system at all right now.

padreputativo avatar Mar 07 '25 18:03 padreputativo

When updating to the new OBS and version 1.28.1, it seems to have been fixed. I'll confirm tomorrow. It could have happened because the CPU was being used at 30% by the OBS browser, and now that there's more free CPU, maybe it's not blocking that thread (or something like that).

padreputativo avatar Mar 08 '25 21:03 padreputativo

I am glad to hear that it seemingly resolved to itself although I would prefer to understand the problem.

If you should still encounter the issue you could maybe try the build here, which will be available in a few minutes: https://github.com/WarmUpTill/SceneSwitcher/actions/runs/13741651170

It includes additional handling for cases where the Twitch API signals that it will throttle the connection.

WarmUpTill avatar Mar 08 '25 21:03 WarmUpTill

I confirm that version 1.28.1 is still failing, I will try to test that version.

padreputativo avatar Mar 10 '25 17:03 padreputativo

It would be interesting to receive an alert when the connection is lost. Since I'm on Manjaro, manual installation is complicated for me because the directories are different. It seems that AUR compiles master, so I suppose the version I'm reinstalling will be up to date.

padreputativo avatar Mar 10 '25 17:03 padreputativo

Hi, i have the same problem, did you solve this?

cdante100 avatar Aug 02 '25 16:08 cdante100

I think this might be "solved" with https://github.com/WarmUpTill/SceneSwitcher/commit/ca3bbf56609f520d53656962df9f3d3cb850eba7. A build with a fix is available here: https://github.com/WarmUpTill/SceneSwitcher/actions/runs/18510607507

Sorry for taking so long to track down the potential root cause.

WarmUpTill avatar Oct 14 '25 21:10 WarmUpTill