New issue
Advanced search Search tips

Issue 638378 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: Dec 2016
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug

Blocked on:
issue 588824



Sign in to add a comment

TSAN TaskSchedulerWorkerPoolCheckTlsReuse Reported Race with ThreadLocalStorage

Project Member Reported by robliao@chromium.org, Aug 16 2016

Issue description

The race condition below is expected as we're racing the thread reclaim logic.
ThreadLocalStorage happens to not synchronize anything at the moment. Adding a
lock to synchronize usage of g_tls_destructors won't actually fix the inherent
race condition. In production, it's up the owner to make sure that any
references have cleaned up before releasing the TLS slot.

Given that ThreadLocalStorage will be getting some locks in the future, so I expect to be able to remove the suppression once that goes through.

Write of size 8 at 0x000002092a20 by main thread:
    #0 Free base/threading/thread_local_storage.cc:219:28
(base_unittests+0x000000c824ae)
    #1 base::ThreadLocalStorage::Slot::~Slot()
base/threading/thread_local_storage.cc:251 (base_unittests+0x000000c824ae)
    #2 ~TaskSchedulerWorkerPoolCheckTlsReuse
base/task_scheduler/scheduler_worker_pool_impl_unittest.cc:465:7
(base_unittests+0x0000009bc080)

Previous read of size 8 at 0x000002092a20 by thread T10:
    #0 OnThreadExitInternal base/threading/thread_local_storage.cc:151:11
(base_unittests+0x000000c81f24)
    #1 base::internal::PlatformThreadLocalStorage::OnThreadExit(void*)
base/threading/thread_local_storage.cc:191 (base_unittests+0x000000c81f24)
    #2 __nptl_deallocate_tsd
/build/eglibc-oqps9y/eglibc-2.15/nptl/pthread_create.c:156
(libpthread.so.0+0x000000007c82)

As if synchronized via sleep:
    #0 nanosleep <null> (base_unittests+0x0000004b6287)
    #1 base::PlatformThread::Sleep(base::TimeDelta)
base/threading/platform_thread_posix.cc:178:10 (base_unittests+0x000000c776d3)
    #2
base::internal::TaskSchedulerWorkerPoolCheckTlsReuse_CheckDetachedThreads_Test::TestBody()
base/task_scheduler/scheduler_worker_pool_impl_unittest.cc:526:3
(base_unittests+0x0000009ba595)
    #3 HandleExceptionsInMethodIfSupported<testing::Test, void>
testing/gtest/src/gtest.cc:2458:12 (base_unittests+0x000000d164bc)
 
Cc: gab@chromium.org fdoray@chromium.org
Owner: robliao@chromium.org
Status: Assigned (was: Untriaged)
Blockedon: 588824
Project Member

Comment 3 by bugdroid1@chromium.org, Aug 16 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/ad1893a4eeeb1775709005ad7df0081560fa27d3

commit ad1893a4eeeb1775709005ad7df0081560fa27d3
Author: robliao <robliao@chromium.org>
Date: Tue Aug 16 22:34:57 2016

Suppress TSAN Race in TaskSchedulerWorkerPoolCheckTlsReuse

The race condition is expected as we're racing the thread reclaim
logic. ThreadLocalStorage happens to not synchronize anything at the
moment. Adding a lock to synchronize usage of g_tls_destructors won't
actually fix the inherent race condition. In production, it's up the
owner to make sure that any references have cleaned up before
releasing the TLS slot.

Given that ThreadLocalStorage will be getting some locks in the future,
so I expect to be able to remove the suppression once that goes
through.

BUG= 638378 

Review-Url: https://codereview.chromium.org/2256493002
Cr-Commit-Position: refs/heads/master@{#412362}

[modify] https://crrev.com/ad1893a4eeeb1775709005ad7df0081560fa27d3/build/sanitizers/tsan_suppressions.cc

Comment 4 by gab@chromium.org, Dec 14 2016

Components: Internals>TaskScheduler
Labels: Stability-ThreadSanitizer
@rob: the blocking work has occurred? can this suppression be removed?
Yes, I think we can give it a try.
Project Member

Comment 6 by bugdroid1@chromium.org, Dec 15 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/ab7a70453f0fed95e383d6650f4e318c8519dfa2

commit ab7a70453f0fed95e383d6650f4e318c8519dfa2
Author: robliao <robliao@chromium.org>
Date: Thu Dec 15 19:36:41 2016

Revert "Suppress TSAN Race in TaskSchedulerWorkerPoolCheckTlsReuse"

This reverts commit ad1893a4eeeb1775709005ad7df0081560fa27d3
(https://codereview.chromium.org/2256493002).

BUG= 638378 
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_chromium_tsan_rel_ng

Review-Url: https://codereview.chromium.org/2580603002
Cr-Commit-Position: refs/heads/master@{#438894}

[modify] https://crrev.com/ab7a70453f0fed95e383d6650f4e318c8519dfa2/build/sanitizers/tsan_suppressions.cc

Status: Fixed (was: Assigned)

Sign in to add a comment