-
Notifications
You must be signed in to change notification settings - Fork 845
TSan: Fix data race of updating current time #9168
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
Conversation
19640f1 to
eed8bae
Compare
bryancall
left a comment
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.
Please fix the tests
| Thread(); | ||
|
|
||
| static ink_hrtime cur_time; | ||
| static std::atomic<ink_hrtime> cur_time; |
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.
Thread::cur_time is shared across threads.
trafficserver/iocore/eventsystem/I_Thread.h
Lines 159 to 160 in a5f647a
| @note The cached copy shared among threads which means the cached copy is updated | |
| for all threads if any thread updates it. |
|
@masaori335 agreed to do some performance testing of this patch compared to using |
My very basic benchmark says Anyway, both of them need around 20ns. It still makes sense to have a cache for frequent access.
Performance perspective, thread local seems better (#9184) because it shares nothing. |
|
This pull request has been automatically marked as stale because it has not had recent activity. Marking it stale to flag it for further consideration by the community. |
Fix below TSan report.