[haiku-bugs] Re: [Haiku] #8275: Deadlocking apps when opening documents

  • From: "stippi" <trac@xxxxxxxxxxxx>
  • Date: Sun, 04 Mar 2012 09:57:05 -0000

#8275: Deadlocking apps when opening documents
-------------------------------+----------------------------
   Reporter:  humdinger        |      Owner:  pulkomandy
       Type:  bug              |     Status:  new
   Priority:  normal           |  Milestone:  R1
  Component:  Kits/Locale Kit  |    Version:  R1/Development
 Resolution:                   |   Keywords:
 Blocked By:                   |   Blocking:
Has a Patch:  0                |   Platform:  All
-------------------------------+----------------------------

Comment (by stippi):

 Here is my analysis of the problem. I was observing the same behavior and
 searched Trac if this was already reported.

 What happens is that StyledEdit has two threads threads running at the
 point of the dead-lock, the file panel thread and it's BApplication
 thread. During initializaton, the file panel thread wants to translate
 some system file name. As can be seen in the stack trace,
 MutableLocalRoster calls MakeSureItsLoaded() which in turn looks up an
 image symbol. At this point, it has already grabbed the default locale
 roster lock. Concurrently, the app is trying to load the text file. In
 StyledEdit, this works via translators. As can be seen in the stack trace,
 the BTranslationRoster is loading Translator add-ons. At some point, it
 also deals with image and add-on functions (load_add_on()). Presumably, it
 has at that point grabbed some lock, which the file panel thread also
 wants to grab in the get_image() function. So this is a classic dead-lock
 situation because of reversed locking order. One thread first grabs the
 locale roster lock, then tries to grab an image related lock. The other
 thread first grabs the image related lock, then tries to grab the locale
 roster lock. Each thread is waiting for the other one to release the
 respective lock.

 I am just writing this down, since I don't know when I will have time to
 look into it more. But the solution seems to be to either not hold the
 locale roster lock when ''loading'' locale add-ons, or to make sure the
 locking order is always the same.

-- 
Ticket URL: <http://dev.haiku-os.org/ticket/8275#comment:4>
Haiku <http://dev.haiku-os.org>
Haiku - the operating system.

Other related posts: