[haiku-bugs] Re: [Haiku] #8749: Recursive dependency waiting in the job/worker mechanism can easily result in stack overflows

  • From: "anevilyak" <trac@xxxxxxxxxxxx>
  • Date: Thu, 19 Jul 2012 12:02:32 -0000

#8749: Recursive dependency waiting in the job/worker mechanism can easily 
result
in stack overflows
-------------------------------------+----------------------------
   Reporter:  anevilyak              |      Owner:  bonefish
       Type:  bug                    |     Status:  new
   Priority:  normal                 |  Milestone:  R1
  Component:  Applications/Debugger  |    Version:  R1/Development
 Resolution:                         |   Keywords:
 Blocked By:                         |   Blocking:
Has a Patch:  0                      |   Platform:  All
-------------------------------------+----------------------------

Comment (by anevilyak):

 Replying to [comment:1 bonefish]:
 > As a first step it would be worthwhile to examine, if certain jobs make
 heavy use of the stack. If so, the code could be converted to heap
 allocations. Also, increasing the stack size for the worker threads would
 be possible, though only after decreasing the stack use. Obviously this is
 only an acceptable solution, if the amount of jobs we're talking about, is
 still manageable.

 I can do that, though in some cases that might be a bit more difficult to
 control, since most of them call into other code outside of the job system
 itself. For reference though, what is our default thread stack size
 currently?

 > The more consequent solution is to rewrite the jobs to wait
 asynchronously. I.e. `Do()` would have to return indicating that the job
 is waiting and needs to be re-called when the job it is waiting for is
 done. This requires a bit more overhead in the job implementations, since
 the ones that can wait would need to be stateful.

 This sounds like ultimately a more scalable approach to me, even if it is
 a bit more work.

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

Other related posts: