Skip to content

bug: obs-websocket: requests that change the scene collection do not save it, so a crash or hard stop loses them #811

Closed
obs-rust/obs-websocket
#12

Description

@vpacher

Summary

obs-websocket requests that change the scene collection do not save it. SetInputVolume, SetInputMute, SetInputSettings, SetSceneItemTransform, SetSourceFilterSettings and similar requests change only the live state. The change is written to disk only at the next save: a change in the OBS UI, or a clean exit. After a crash, a SIGKILL, a power loss or a container hard stop, every change made over the websocket since the last save is lost.

A change in the OBS UI saves at once (OBSBasic::SaveProject(), for example from the properties, filters and advanced audio dialogs). Remote control setups (Stream Deck / Bitfocus Companion, Home Assistant, scripts) make all their changes over the websocket, so for them nothing is saved during a whole session.

Some websocket changes are already saved by accident: creating, removing or reordering scene items triggers the frontend's scene signal handlers (OBSBasic::ReorderSources, RefreshSources, AddSceneItem), which call SaveProject(). Settings, transform, volume, mute and filter changes have no such path.

Location

plugins/obs-websocket/src/requesthandler/RequestHandler.cpp (obs-rust/obs-websocket), RequestHandler::ProcessRequest():

	return std::bind(handler, this, std::placeholders::_1)(request);

The handler result is returned without a save. In the whole plugin, the only save call is obs_frontend_save_streaming_service() in SetStreamServiceSettings; obs_frontend_save() is never called.

Class

Data loss: a successful change is not persisted.

How it is reached

Reproduced with the master build (aaed86f) on Debian 13, headless, OBS started by a systemd unit:

  1. SetInputVolume on an input to a new value. GetInputVolume returns the new value.
  2. Wait. The scene collection JSON (basic/scenes/<name>.json) still has the old value.
  3. systemctl kill -s KILL <unit>, start again: the old value is back.

Upstream obsproject/obs-websocket master has the same ProcessRequest() and no obs_frontend_save() call in any request handler; the loss was also seen in production with OBS 30.2.3 (Debian package). A real-world trigger: Home Assistant's Proxmox integration stops containers with a hard stop, so every websocket change of the day was lost every evening.

Proposed fix and failing test

Fix (obs-rust/obs-websocket): after a request from an explicit list succeeds, queue obs_frontend_save() for the UI thread with obs_queue_task(OBS_TASK_UI, ..., false).

  • The list (src/requesthandler/SceneCollectionChanges.h) has the requests that change scenes, inputs, filters, scene items or transitions, plus SetSourcePrivateSettings.
  • Scene switches (SetCurrentProgramScene, SetCurrentPreviewScene, TriggerStudioModeTransition) are not in the list. The UI does not save on a scene switch either, and a switch must not write the file every time.
  • Profile, config and output requests are not in the list. They store their data through their own code.
  • The task does not wait. OBSBasic::SaveProject() defers the write, so a burst of requests results in one save.

RED test (test/cmocka/test_ws_save_changes, in the pattern of test_ws_transform_bounds): compiles the plugin's request handlers from the submodule against real libobs and the frontend API library, registers a dummy input, sets a counting UI task handler (obs_set_ui_task_handler) and sends requests through RequestHandler::ProcessRequest:

  • SetInputVolume (success) queues 1 UI task (the save). Fails today: 0.
  • GetInputVolume queues none (passes before and after).
  • SetInputVolume on a missing input (error) queues none (passes before and after).

GREEN: the submodule moves to the obs-websocket fix commit.

End-to-end check done with the fix: the JSON on disk has the new value 2 s after SetInputVolume, while OBS keeps running, and the value survives kill -9 and a restart.

Activity

  1. vpacher commented on Oct 15, 2026

    @vpacher
    MemberAuthor

    Claiming: this issue.

    1. obs-rust/obs-websocket PR: after a successful request from an explicit list (src/requesthandler/SceneCollectionChanges.h), queue obs_frontend_save() for the UI thread without waiting. Scene switches are not in the list.
    2. obs-studio PR, RED: test/cmocka/test_ws_save_changes sends requests through RequestHandler::ProcessRequest against real libobs and counts the UI tasks. SetInputVolume queues 0 today, so the test fails.
    3. GREEN: move plugins/obs-websocket to the merged fix commit.
      PRs today (the obs-studio one as a draft until the obs-websocket PR merges).
  2. added a commit that references this issue on Oct 16, 2026
    fe628a3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions