[Openais] Re: FW: Evt Deadlock

Muni Bajpai muniba at nortel.com
Tue Jan 24 14:56:59 PST 2006


That analysis makes me feel more comfortable. Thanks for taking the time
to break it down. Will update and run traffic.

-----Original Message-----
From: Steven Dake [mailto:sdake at mvista.com] 
Sent: Tuesday, January 24, 2006 4:37 PM
To: Bajpai, Muni [RICH1:B670:EXCH]
Cc: Mark Haverkamp; openais at lists.osdl.org; scd at broked.org; Smith,
Kristen [RICH1:B670:EXCH]
Subject: RE: [Openais] Re: FW: Evt Deadlock

Muni
One way your suggestion could work is if the same thread retakes the
handle database lock (calling get/put within a destructor for for handle
database would deadlock since the destructor is called under lock).

Your scenario:
SaHandlePut on a channel handle, which drops the reference count to 0

This calls the destructor for the channel chanHandleInstanceDestructor
with the channel handle locked.  If the channel contains events, this
calls saEvtEventFree, which would drop the ref count to 0, which calls
eventHandleInstanceDestructor.

This scenario doesn't try to re-take the channel lock though.

Another scenario
saHandlePut on an evt handle, which drops the reference count to 0.
This calls the destructor evtHandleInstanceDestructor, which gets the
channel handle database and then destroys it and puts it.  In this case,
it would appear that events are probably leaked,

This scneario doesn't try to re-take the evt lock though

Another scenario
saHandlePut on event handle, which drops the ref count to 0.  THis calls
the destructor eventHandleInstanceDestructor which does no gets,puts
taking or releasing locks.

This scenario doesn't try to re-take the event lock though

So I think the possibility of this problem (double-take lock within a
destructor) doesn't exist in the event service.

It appears to me the destructors are all correct.

I have also analyzed the code prior to mark's previous patch, and that
doesn't appear to have the nested lock in destructor.

I suspect we nailed this bug with mark's previous patch and 1029.

Regards
-steve

On Tue, 2006-01-24 at 15:42 -0600, Muni Bajpai wrote:
> So I think the basic premise of what I saw was that In the HandlePut
> call, the thread in question was holding the channel_handle_db lock
and
> requesting the event_handle_db lock. So for deadlock to happen another
> thread has to hold at least the event_handle_db lock and requesting
the
> channel_handle_db lock. 
> 
> I'm not sure if any path in make_event can fulfill the above criteria
> (0.70 code) to cause a lock but then again I might be missing
something
> 
> Thanks
> 
> Muni
> 
> -----Original Message-----
> From: Mark Haverkamp [mailto:markh at osdl.org] 
> Sent: Tuesday, January 24, 2006 3:17 PM
> To: sdake at mvista.com
> Cc: Bajpai, Muni [RICH1:B670:EXCH]; openais at lists.osdl.org;
> scd at broked.org
> Subject: Re: [Openais] Re: FW: Evt Deadlock
> 
> On Tue, 2006-01-24 at 12:27 -0700, Steven Dake wrote:
> [ ... ]
> 
> > 
> > Mark, I'd take a second look at your saHandleDestroy calls as they
may
> > have some kind of problem.
> 
> OK, I found a bad bug.  I don't know if it is related to anyones
> trouble, but it is bad.  In make_event (creates an event structure in
> the library code) the new event is destroyed if there are any errors.
I
> was using the wrong handle database to destroy the event handle.  Here
> is the patch.  This will need to be checked into the picacho branch
too.
> I'll create a bugzilla entry too.
> 
> Mark.
> 
> 






More information about the Openais mailing list