TSAN: attribute no_sanitize_thread not working

183 views
Skip to first unread message

Jie Zhang

unread,
Jan 28, 2023, 3:59:11 AM1/28/23
to thread-sanitizer
Hi all,

My app is running slow and very unstable with TSAN enabled. The app keeps healing (when communication timeout etc.) itself while there are still plenty cpu and memory resources left. We used the perf to catch cpu informations, and found out that our logging functions are being heavily sanitized by TSAN and consume lots of cpu resources. We tried to add no_sanitize_thread attributes to logging functions, but it does not work. Is there anyway to avoid tsan placing stub on specific functions? (the log.so is not even compiled with tsan option) or any idea on how to make a large app run faster?

BTW: Im using gcc 7.3.0 on Linux

Thanks!
Message has been deleted

Dmitry Vyukov

unread,
Jan 30, 2023, 3:51:09 AM1/30/23
to Jie Zhang, thread-sanitizer
On Sat, 28 Jan 2023 at 10:02, Jie Zhang <jie...@gmail.com> wrote:
>
> Hello all,
>
> I have a large app that runs slowly and really unstable with TSAN enabled, while CPU and memory resources are still redundent. We have to adjust the app's timeout for TSAN to avoid communication failures etc. We used perf to catch cpu running informations, and found out that cpu spends lots of time on sanitizing our logging functions. We added the no_sanitize_thread attribute to that function, but it does not work. Is there a way to avoid certain functions being sanitized by TSAN ? or any idea to make large app run faster?
>
> We are using gcc 7.3.0 on linux.
>
> Thanks!

Hi Jie,

If there would be a magical switch that just makes things faster, it
would be enabled by default :)

gcc 7.3.0 is very old, latest versions may have bugs fixed and make
things faster.
Recent clang releases got significantly faster tsan runtime.

Jie Zhang

unread,
Feb 1, 2023, 2:23:06 AM2/1/23
to thread-sanitizer
Thanks for your quick response!

Switching the whole project to clang may require lots of work...   ANNOTATE_IGNORE_WRITES_BEGIN(from the TSAN paper), ignore_noninstrumented_modules (from github manual), can these two methods disable TSAN for specific functions?  Any demos on how to use them?

Dmitry Vyukov

unread,
Feb 1, 2023, 2:42:42 AM2/1/23
to Jie Zhang, thread-sanitizer

--
You received this message because you are subscribed to the Google Groups "thread-sanitizer" group.
To unsubscribe from this group and stop receiving emails from it, send an email to thread-sanitiz...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/thread-sanitizer/fc89ef2a-463f-4139-9c15-50cacc759a93n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages