Closed Bug 165639 Opened 22 years ago Closed 22 years ago

NSSRWLock_UnlockWrite can cause deadlock

Categories

(NSS :: Libraries, defect, P2)

defect

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: julien.pierre, Assigned: wtc)

References

Details

Attachments

(1 file, 1 obsolete file)

When using the re-entrant feature of this lock, deadlocks can occur.
I ran into it with the CRL cache.

The test case is :

acquire the lock for write
acquire the lock for read
unlock the lock for write
unlock the lock for read

Wan-Teh produced a patch for this problem that I will attach.
Priority: -- → P2
Target Milestone: --- → 3.6
Attached patch resolve deadlock (obsolete) — Splinter Review
Blocks: 149854
This patch is equivalent to and shorter than the previous patch
Attachment #97288 - Attachment is obsolete: true
The problem was that NSSRWLock_UnlockWrite failed to
wake up waiting readers when the thread releasing
the writer lock still owned the reader lock.  Under
this condition, it is fine to let other threads
share the reader lock.

Since this implementation gives preference to waiting
writers, my patch only wakes up waiting readers if
there is no waiting writer.

I have checked the new patch into the tip.  Julien,
please verify the fix.  I'd also appreciate a code
review by the author of nssrwlk.{h,c}.
Status: NEW → RESOLVED
Closed: 22 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: