yibaini / thread-sanitizer

Automatically exported from code.google.com/p/thread-sanitizer
0 stars 0 forks source link

The information about locks should include the stack trace of the last "lock" operation #52

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
See https://code.google.com/p/chromium/issues/detail?id=348324 as the example 
of the difference between TSan v1 and TSan v2.

Original issue reported on code.google.com by timurrrr@google.com on 7 Mar 2014 at 9:20

GoogleCodeExporter commented 9 years ago
I am not sure about the *last* stack trace. 
Here is what I have now (still changing, but you should get the idea). 
https://code.google.com/p/thread-sanitizer/wiki/DeadlockDetector

WARNING: ThreadSanitizer: lock-order-inversion (potential deadlock) (pid=18360)
  path: M0 => M1 => M0

  edge: M0 => M1
    #0 pthread_mutex_lock
    #1 main /tmp/mutex_cycle2.c:9 (a.out+0x00000008bad8)

    #0 pthread_mutex_lock
    #1 main /tmp/mutex_cycle2.c:10 (a.out+0x00000008bae4)

  edge: M1 => M0
    #0 pthread_mutex_lock
    #1 main /tmp/mutex_cycle2.c:15 (a.out+0x00000008bb08)

    #0 pthread_mutex_lock
    #1 main /tmp/mutex_cycle2.c:16 (a.out+0x00000008bb14)

  Mutex M0 (0x7fff29bae908) created at:
    #0 pthread_mutex_init
    #1 main /tmp/mutex_cycle2.c:5 (a.out+0x00000008bab6)

  Mutex M1 (0x7fff29bae8e0) created at:
    #0 pthread_mutex_init
    #1 main /tmp/mutex_cycle2.c:6 (a.out+0x00000008bacc)

Thoughts? 

Original comment by konstant...@gmail.com on 18 Mar 2014 at 6:10

GoogleCodeExporter commented 9 years ago
I don't understand what your example demonstrates regarding to the format of a 
data report (not dead lock report).

Original comment by timurrrr@google.com on 18 Mar 2014 at 7:59

GoogleCodeExporter commented 9 years ago
Agreed, afaict this is not regarding the deadlock detector, but that valgrind 
tsan used to report the following:

  Locks involved in this report (reporting last lock sites): {L20476}
   L20476 (0xC996DF11808)
    #0  pthread_mutex_lock ts_valgrind_intercepts.c:941
    #1  base::internal::LockImpl::Lock base/synchronization/lock_impl_posix.cc:45
    #2  base::Lock::Acquire base/synchronization/lock.h:22
    #3  base::AutoLock::AutoLock base/synchronization/lock.h:102
    #4  gpu::InProcessCommandBuffer::FlushOnGpuThread gpu/command_buffer/service/in_process_command_buffer.cc:496
    #5  base::internal::RunnableAdapter::Run base/bind_internal.h:190

Original comment by pbos@google.com on 18 Mar 2014 at 8:45

GoogleCodeExporter commented 9 years ago
Adding Project:ThreadSanitizer as part of GitHub migration.

Original comment by gli...@google.com on 30 Jul 2015 at 9:21