obs-websocket-community-projects / obs-websocket-js

Consumes https://github.com/obsproject/obs-websocket
MIT License
657 stars 95 forks source link

OBS crash when calling SetSceneItemEnabled in batch mode on websocket via Node only #337

Open msikma opened 10 months ago

msikma commented 10 months ago

Description:

I noticed this crash today while working on my obs-websocket code. To explain what I'm doing: in one of my scenes, I'm turning some scene items on or off depending on which application is active. So when I'm playing game A, it finds a list of sources corresponding to that game and then sends a batch call to turn some on, and some off.

I've got obs-websocket-js code that both runs on Node (a bot that does stuff automatically) and runs in the browser (an admin panel). I noticed that this somehow only occurs on obs-websocket-js on Node, and not in the in-browser JS version. In both cases I'm running 5.0.2 but I confirmed the crash on 5.0.3 too.

The scene source type doesn't seem to matter.

Steps to reproduce:

  1. Connect via obs-websocket-js on Node
  2. Send a batch call of SetSceneItemEnabled to make multiple scene sources enabled/disabled

Expected result:

OBS sets the sources to their respective enabled/disabled values.

Actual result:

OBS crashes.

Notes:

As I mentioned this only happens on Node. I do the same thing in my admin panel, and that one works fine. I'm not sure if there's a way to easily debug exactly what messages it's sending to OBS over the socket.

I was able to get around the crash by not doing the calls in batch, by doing regular obsClient.call() calls wrapped in a Promise.all().