[haiku-bugs] Re: [Haiku] #15211: KDL in MultiLocker::ReadLock()

  • From: "Haiku" <trac@xxxxxxxxxxxx>
  • To: undisclosed-recipients: ;
  • Date: Fri, 02 Aug 2019 09:12:24 -0000

#15211: KDL in MultiLocker::ReadLock()
-----------------------------+----------------------------
   Reporter:  3dEyes         |      Owner:  waddlesplash
       Type:  bug            |     Status:  assigned
   Priority:  normal         |  Milestone:  Unscheduled
  Component:  System/Kernel  |    Version:  R1/Development
 Resolution:                 |   Keywords:
 Blocked By:                 |   Blocking:
Has a Patch:  0              |   Platform:  All
-----------------------------+----------------------------

Comment (by tqh):

 I don't think the current multilocker looks safe. The check if it is
 locked and the action afterward is not done in any kind of transaction. No
 lock, no mem barrier. So when the action is done it might have already
 changed state by another thread.
 If it is intentional that several threads see it as unlocked and then
 start locking it should be documented.
 I also see problems if several threads would call destruction.

 I don't think these kind of changes should be done this lightly, and I
 would like to see some tests to guarantee that it has been proven to work
 before commited.

 You should be able to test this with mock threads and sleeps right after
 each lock check return otherwise you will have subtle errors like this
 where lock thread will be updated as soon as sem is relaased as others
 hang there.

-- 
Ticket URL: <https://dev.haiku-os.org/ticket/15211#comment:15>
Haiku <https://dev.haiku-os.org>
The Haiku operating system.

Other related posts: