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
TSan: CurrentTimeString uses non-reentrant localtime() from every logging thread #132
Found by the TSan launch pass (meta issue linked as parent). Upstream OBS code, unchanged in this fork.
Race
WARNING: ThreadSanitizer: data race
Write of size 8 by thread T49 'threaded-ml':
#0 localtime
#1 CurrentTimeString() frontend/obs-main.cpp:94
#2 LogStringChunk frontend/obs-main.cpp:124
#3 do_log frontend/obs-main.cpp:233
#4 blogva libobs/util/base.c:116
Previous write of size 8 by thread T8 'audio-io: audio':
#0 localtime ... same stack
Location is global '_tmbuf' (libc)
Cause
CurrentTimeString() uses localtime(), which returns a pointer to a static buffer shared by every thread. blog() is called from the audio, video, capture and UI threads at the same time, so two log lines can swap or corrupt each other's timestamps.
Fix
Use localtime_r(&now, &tstruct) (localtime_s on Windows), the same as the rest of libobs's platform code.
Activity
zackees commentedon Oct 13, 2026
Claiming: #132. Plan:
localtime_r/localtime_sinCurrentTimeString(). One PR.ci: Ban the non-reentrant localtime() in the frontend (RED)
frontend: Use the reentrant localtime in timestamps and filenames (GR…