You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
libobs: stop signal still races a previous stop's encoder shutdown on last_error #2110
Follow-up of #2086/#2098 (#2087, #2100). After those fixes, TSan run 40078572852 still has 7 obs_encoder_set_last_error (obs-encoder.c.h:2231) reports against obs_output_get_last_error (obs-output.c.h:2738), in test_encoding_lag_rescale and one other test.
The case: a stop on the not-active path (obs_output_end_data_capture_internal:2374, here from obs_output_destroy → obs_output_actual_stop) builds the stop params while the previous stop's end_data_capture_thread is still running stop_video_encoders → obs_encoder_shutdown, which frees the encoder's last_error_message. That path deliberately doesn't join a running thread ("this never waits"). Reordering can't fix it.
Options:
In stop_params_init, copy the encoder's message under the mutex obs_encoder_set_last_error runs under. Check lock order against obs_encoder_shutdown's callers first.
Give last_error_message its own small mutex, and have internal readers copy under it.
The public obs_encoder_get_last_error/obs_output_get_last_error return a borrowed pointer, so external callers keep upstream's contract either way. Low risk (local).
Activity
zackees commentedon Oct 24, 2026
Claiming: this issue.
libobs: Copy the encoders' last error under a lock for the stop signal (