Repository navigation
Description
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:
SetInputVolumeon an input to a new value.GetInputVolumereturns the new value.- Wait. The scene collection JSON (
basic/scenes/<name>.json) still has the old value. 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, plusSetSourcePrivateSettings. - 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.GetInputVolumequeues none (passes before and after).SetInputVolumeon 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.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
vpacher commentedon Oct 15, 2026
Claiming: this issue.
src/requesthandler/SceneCollectionChanges.h), queueobs_frontend_save()for the UI thread without waiting. Scene switches are not in the list.test/cmocka/test_ws_save_changessends requests throughRequestHandler::ProcessRequestagainst real libobs and counts the UI tasks.SetInputVolumequeues 0 today, so the test fails.plugins/obs-websocketto the merged fix commit.PRs today (the obs-studio one as a draft until the obs-websocket PR merges).
infra: Claim bot labels and assigns claimants, expires stale claims (o…
requesthandler: Save the collection after changes
test/cmocka: Test that websocket changes are saved
obs-websocket: Save the collection after changes
obs-websocket: Save the scene collection after changes (obs-rust#812)
requesthandler: Save the collection after changes (obs-rust#12)