Opened 5 years ago

Closed 5 years ago

#204 closed defect (fixed)

pthread: wrlock() causes CPU load to 99.9% and tryrdlock()/trywrlock() falls into deadlock

Reported by: KO Myung-Hun Owned by:
Priority: major Milestone:
Component: *none Version:
Severity: medium Keywords:
Cc:

Description

Hi/2.

Let's see the following case.

  1. main thread: acquire rdlock
  2. second thread: try to acquire wrlock
  3. third thread: try to acquire tryrdlock

In 2., CPU load gets to 99.9% because of a tight loop in pthread_rwlock_wrlock(). And In 3., deadlock occurs in pthread_rwlock_tryrdlock() because lock->mutex is not released in pthread_rwlock_wrlock().

This occured in the test of pthread_rwlock_rdlock.m4.

Attachments (1)

rwlock_deadlock_tight_loop.diff (1.9 KB) - added by KO Myung-Hun 5 years ago.
Patch for deadock in pthread_rwlock_tryrdlock()/trywrlock() and a tight loop in thread_rwlock_rdlock()/wrlock()

Download all attachments as: .zip

Change History (2)

Changed 5 years ago by KO Myung-Hun

Patch for deadock in pthread_rwlock_tryrdlock()/trywrlock() and a tight loop in thread_rwlock_rdlock()/wrlock()

comment:1 Changed 5 years ago by Silvan Scherrer

Resolution: fixed
Status: newclosed

fixed in r2328
thx for the patch

Note: See TracTickets for help on using tickets.