HeitorMP / 42-Philosophers

1 stars 0 forks source link

Deadlocks #1

Open HeitorMP opened 1 year ago

HeitorMP commented 1 year ago
WARNING: ThreadSanitizer: lock-order-inversion (potential deadlock) (pid=171143)
  Cycle in lock order graph: M4 (0x7b3000000070) => M3 (0x7b3000000010) => M4

  Mutex M3 acquired here while holding mutex M4 in thread T1:
    #0 pthread_mutex_lock <null> (philo+0x4428e6)
    #1 try_to_eat_odd <null> (philo+0x4b6738)

    Hint: use TSAN_OPTIONS=second_deadlock_stack=1 to get more informative warning message

  Mutex M4 acquired here while holding mutex M3 in thread T2:
    #0 pthread_mutex_lock <null> (philo+0x4428e6)
    #1 try_to_eat_odd <null> (philo+0x4b6738)

  Thread T1 (tid=171145, running) created by main thread at:
    #0 pthread_create <null> (philo+0x424b3b)
    #1 init_threads <null> (philo+0x4b6b01)

  Thread T2 (tid=171146, running) created by main thread at:
    #0 pthread_create <null> (philo+0x424b3b)
    #1 init_threads <null> (philo+0x4b6b01)

SUMMARY: ThreadSanitizer: lock-order-inversion (potential deadlock) (/nfs/homes/hmaciel-/42cursus/Workplace/42-Philosophers/philos/philo+0x4428e6) in pthread_mutex_lock
HeitorMP commented 1 year ago

Solved...