Skip to content
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

TSAN: reconcile report_thread_leaks with dart:io's exit #41811

Open
rmacnak-google opened this issue May 7, 2020 · 2 comments
Open

TSAN: reconcile report_thread_leaks with dart:io's exit #41811

rmacnak-google opened this issue May 7, 2020 · 2 comments
Labels
area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends.

Comments

@rmacnak-google
Copy link
Contributor

dart:io's exit call's libc's exit without first calling Dart_Cleanup. This can cause TSAN to complain about leaks of VM thread pool threads. Ideally we would inform TSAN that when we exit this way we don't care about leaks (and likewise for LSAN), but there doesn't appear to be a way to set TSAN's report_thread_leaks at runtime. We don't want completely ignore thread leak reportings because it is useful when we shutdown gracefully (main isolate completes its message and has no open receive ports).

@rmacnak-google rmacnak-google added the area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. label May 7, 2020
@mkustermann
Copy link
Member

The puzzling thing is that global C++ state should be treated as strong roots by the leak sanitizer and therefore everything (transitively) reachable from it should not be considered as leaks. See lsan design doc

So I would assume the global thread pool, various global mutexes/monitors and global lists are treated as roots. One of those roots is a global list of isolate groups, each of which has a list of isolates. So all those resources should not be considered as leaks.

dart-bot pushed a commit that referenced this issue May 8, 2020
Bug: #41811
Change-Id: I576985c45969bbd379f3f55ab41aa79a8ce77b6b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/147328
Reviewed-by: Alexander Aprelev <aam@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
dart-bot pushed a commit that referenced this issue May 12, 2020
Mostly interesting on Mac, where ASAN does not include LSAN.

Bug: #41811
Change-Id: Icbbe57946a6d3b3406a9e3a6541b6c4958cbfa91
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/147685
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
@rmacnak-google
Copy link
Contributor Author

Thanks for the pointer, I had misunderstood LSAN as wanting everything to have been freed before exit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends.
Projects
None yet
Development

No branches or pull requests

2 participants