Skip to content

libobs: source show/activate ref counts are read without atomics (TSan, ~150 reports) #2081

Closed

Description

@zackees

obs_source_activate/deactivate/show/hide change activate_refs and show_refs with os_atomic_inc_long/dec, but six places read them as plain fields: obs_source_active() and obs_source_showing() (which the audio thread calls in audio_callback), the tick's now_showing/now_active (obs-source.c.h:1409 and :1432), and the loops in obs_source_add_active_child/remove_active_child. In TSan run 40066620813 these are about 150 reports in 16+ tests (obs-source.c.h:4834/1409/1432 against threading-posix.h:21 and :26).

Fix: read them with os_atomic_load_long; the child loops take one snapshot.

Activity

  1. zackees commented on Oct 24, 2026

    @zackees
    MemberAuthor

    Claiming: atomic loads at the six read sites, TSan run as RED/GREEN evidence. PR today.

  2. added
    claimed
    on Oct 24, 2026
  3. zackees commented on Oct 24, 2026

    @zackees
    MemberAuthor

    Fixed by #2083 (merged). TSan reports at the ref-count reads went from 49 to 0, and obs_source_video_tick race sides from 88 to 1.

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

    claimed

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions