Skip to content

Scene Cache Can Become Stale #7

@LinuxMainframe

Description

@LinuxMainframe

Medium: Scene Cache Can Become Stale

Priority: MEDIUM

Type: Logic Issue

Location

libwsv5.c line 2015 in obsws_set_current_scene()

Issue

Scene cache optimization can skip necessary scene switches if events are delayed:

pthread_mutex_lock(&conn->scene_mutex);
bool already_current = (conn->current_scene && strcmp(conn->current_scene, scene_name) == 0);
pthread_mutex_unlock(&conn->scene_mutex);

if (already_current) {
    obsws_log(conn, OBSWS_LOG_DEBUG, "Already on scene: %s", scene_name);
    if (response) {
        *response = calloc(1, sizeof(obsws_response_t));
        (*response)->success = true;
    }
    return OBSWS_OK;  // ← Returns without actually switching!
}

Scenario

  1. User switches scene via OBS UI: Scene1 → Scene2
  2. Event notification is delayed (network lag, busy OBS)
  3. Cache still shows "Scene1"
  4. Application calls obsws_set_current_scene(conn, "Scene2", ...)
  5. Function thinks Scene2 is current, returns without switching
  6. Scene is actually Scene1, not Scene2

Impact

  • Rare edge case but could cause confusion
  • Application thinks scene switched but it didn't
  • Scene gets out of sync with application state

Metadata

Metadata

Assignees

No one assigned

    Labels

    MEDIUMNot a risk, but definitely would improve functionality

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions