-
Notifications
You must be signed in to change notification settings - Fork 409
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix ThreadSanitizer: std::localtime()
is not thread-safe.
#4344
Fix ThreadSanitizer: std::localtime()
is not thread-safe.
#4344
Conversation
[REVIEW NOTIFICATION] This pull request has been approved by:
To complete the pull request process, please ask the reviewers in the list to review by filling The full list of commands accepted by this bot can be found here. Reviewer can indicate their review by submitting an approval review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
null pointer on error (which may be a runtime constraint violation or a failure to convert the specified time to local calendar time)
LGTM, but shall we check null pointers (i.e. throw exceptions instead)? cc @JaySon-Huang
Good catch. However, throwing exceptions maybe not a good idea, cause the exception usually is thrown to BaseDaemon, and leads to more logs while printing those exceptions. It will make things out of control. I think if Finally we decide to use "1970/01/01 00:00:00.000 +00:00" for invalid result |
LGTM. |
…lash into thread-safe-localtime
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with minor comment
/merge |
@Lloyd-Pottiger: It seems you want to merge this PR, I will help you trigger all the tests: /run-all-tests You only need to trigger If you have any questions about the PR merge process, please refer to pr process. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the ti-community-infra/tichi repository. |
@Lloyd-Pottiger: In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the ti-community-infra/tichi repository. |
@SchrodingerZhu @JinheLin PTAL again |
/run-unit-test |
Coverage for changed files
Coverage summary
full coverage report (for internal network access only) |
/merge |
@JaySon-Huang: It seems you want to merge this PR, I will help you trigger all the tests: /run-all-tests You only need to trigger If you have any questions about the PR merge process, please refer to pr process. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the ti-community-infra/tichi repository. |
This pull request has been accepted and is ready to merge. Commit hash: 93498da
|
Coverage for changed files
Coverage summary
full coverage report (for internal network access only) |
Coverage for changed files
Coverage summary
full coverage report (for internal network access only) |
Replace thread-unsafe
std::localtime()
inDB::UnifiedLogPatternFormatter::getTimestamp()
withlocaltime_r()
What problem does this PR solve?
Issue Number: close #4303
Problem Summary:
What is changed and how it works?
Replace thread-unsafe
std::localtime()
inDB::UnifiedLogPatternFormatter::getTimestamp()
withlocaltime_r()
. Becausestd::localtime()
is not thread-safe,localtime_r()
is thread-safe.Check List
Tests
Side effects
Documentation
Release note