Repository navigation
frontend: Use the reentrant localtime in timestamps and filenames - #418
Merged
Merged
Conversation
…EEN) CurrentTimeString stamps every log line from the audio, video, capture and UI threads, and localtime() shares one static buffer between them. The other frontend callers move too: localtime_r, or localtime_s on Windows. Closes #132 Local-Gate: v1 tree=c6b21014861dd61d1d108f9466394e5f1e3631b7 secs=130 lanes=lint:run,rust-test:run,tier2-linux:run Ci-Attestation: {"at":1791852596,"gate":"rust/all/fmt","host":"linux-x86_64","key":"0b777466bd39d4136d790559551d68767cb54da020eac8c3447fdb56af3d5748","lane":"lint","parents":["6670cc5130760ac38dc74df9480c8f48fc1d3cd3"],"secs":16,"stamp":"da52584d2cfcf98c0dad5efe9bb7d07a","tree":"c6b21014861dd61d1d108f9466394e5f1e3631b7","v":1,"via":"run"} Ci-Attestation: {"at":1791852596,"gate":"rust/x86_64-unknown-linux-gnu/clippy","host":"linux-x86_64","key":"0b777466bd39d4136d790559551d68767cb54da020eac8c3447fdb56af3d5748","lane":"lint","parents":["6670cc5130760ac38dc74df9480c8f48fc1d3cd3"],"secs":16,"stamp":"8feb0f214c7b5e68ded72684b7ab5785","tree":"c6b21014861dd61d1d108f9466394e5f1e3631b7","v":1,"via":"run"} Ci-Attestation: {"at":1791852596,"gate":"rust/x86_64-unknown-linux-gnu/test","host":"linux-x86_64","key":"e7ea5ac5f3680b5589986af5502f44b60352b526f4358dbb2b8a587f6294b38f","lane":"rust-test","parents":["6670cc5130760ac38dc74df9480c8f48fc1d3cd3"],"secs":52,"stamp":"e70b4345fd44cbf84ea1e07e6217dc09","tree":"c6b21014861dd61d1d108f9466394e5f1e3631b7","v":1,"via":"run"} Ci-Attestation: {"at":1791852596,"gate":"cpp/linux-x64/tier2","host":"linux-x86_64","key":"f081348bc641e683a558f77e302ee85442c7469ffb1361cb0724bd227aa3f953","lane":"tier2-linux","parents":["6670cc5130760ac38dc74df9480c8f48fc1d3cd3"],"secs":61,"stamp":"1bbf8ab0fcdde231955dc35edd52e1aa","tree":"c6b21014861dd61d1d108f9466394e5f1e3631b7","v":1,"via":"run"}
2 of 3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #132.
CurrentTimeString()(frontend/obs-main.cpp) stamps everyblog()line, andblog()runs on the audio, video, capture and UI threads at once.localtime()returns one static buffer shared by all of them, so concurrent log lines could swap or corrupt timestamps (TSan: data race on libc_tmbuf).ci/test_localtime.py(run by./lint) bans plainlocaltime(/std::localtime(underfrontend/and lists 4 sites. The race itself isn't deterministic to test; the call pattern is.localtime_r, orlocaltime_son Windows:CurrentTimeString,CurrentDateTimeStringandGenerateTimeDateFilename(OBSApp.cpp), andbuildCrashLogUploadContent(CrashHandler.cpp).Not touched:
os_generate_formatted_filenameinlibobs/util/platform.chas the same pattern, but that file is claimed under #262. I've flagged it there.obs-win-crash-handler.cruns once at crash time.The frontend isn't compiled by the local gate, so this PR's full OBS builds are the compile check for both branches. The local gate passed and is stamped.