[haiku-bugs] Re: [Haiku] #6673: [registrar] can be crashed by running multiple instances of mimeset

  • From: "bonefish" <trac@xxxxxxxxxxxx>
  • Date: Wed, 20 Apr 2011 11:48:46 -0000

#6673: [registrar] can be crashed by running multiple instances of mimeset
---------------------------------+----------------------------
   Reporter:  samui              |      Owner:  bonefish
       Type:  bug                |     Status:  new
   Priority:  critical           |  Milestone:  R1
  Component:  Servers/registrar  |    Version:  R1/Development
 Resolution:                     |   Keywords:
 Blocked By:                     |   Blocking:
Has a Patch:  0                  |   Platform:  All
---------------------------------+----------------------------

Comment (by bonefish):

 The KDL is tracked in #5474.

 Regarding the Tracker crash, that's due to `BPoseView::CreatePoses()` not
 checking the return value of `be_clipboard->Lock()`, just assuming it
 worked. Since `BClipboard::Lock()` does synchronous messenging, which
 might require a port to be created on the fly, running out of ports can
 cause `BClipboard::Lock()` to fail.

 Why the system is running out of ports is an interesting question, though.
 The registrar seems to limit the MIME update threads to 12, denying any
 further requests after the limit is reached. So, at least in theory, there
 shouldn't be any resources piling up in the registrar due to MIME update
 requests. The output of a `listport` (or `ports` in KDL -- long, so skip
 and fetch from syslog) in such a situation would at least help to identify
 who is leaking/hogging what kind of ports.

 Why the registrar crashes is another interesting question. One stack trace
 is an hoard assert, so the heap had been corrupted. The other is an
 outright crash in `MIMEManager::MessageReceived()`, though I haven't
 spotted any suspicious code (the syslog would have been nice). Might also
 be a side effect of a heap corruption.

 What looks a bit suspicious is `RegistrarThreadManager`. It uses atomic
 operations to change `fThreadCount`, but doesn't do any locking to protect
 the thread list (`fThreads`). I haven't investigated this further, but so
 far I've seen the `RegistrarThreadManager` only being used in the
 `MIMEManager`s thread. So the atomic operations might simply be
 superfluous.

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

Other related posts: