You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@trafficserver.apache.org by Walt Karas <wk...@oath.com.INVALID> on 2018/09/15 01:23:46 UTC

Possible thread lockup due to AcidPtr?

It looks to me like the AcidPtr docs need a prominent waring that a
thread should have two instances of these (or AcidCommitPtr) in
existence at the same time.  If the addresses of the two protected
objects hashed to the same mutex, wouldn't it cause the thread to lock
up (due to trying to lock the same mutex twice)?  If this did happen,
it would be very hard to debug.

Re: Possible thread lockup due to AcidPtr?

Posted by Derek Dagit <de...@oath.com.INVALID>.
> The assert would be good but I think the docs need a warning that two
AcidPtr instances or two AcidCommitPtr instances should not exist at the
same time in the same thread.

+1 for clarification


On Mon, Sep 17, 2018 at 1:51 PM, Walt Karas <wk...@oath.com.invalid> wrote:

> The assert would be good but I think the docs need a warning that two
> AcidPtr instances or two AcidCommitPtr instances should not exist at
> the same time in the same thread.
>
> On Mon, Sep 17, 2018 at 1:36 PM, Aaron Canary <ac...@oath.com.invalid>
> wrote:
> > yes. I had considered using a recursive mutex to handle this case. I
> chose
> > not to support it because locking multiple things and write to them at
> > the same time is against the spirit of ACID style databases.
> >
> > I suppose I could add an assert when a lock is waiting on a mutex owned
> by
> > the same thread.
> >
> > On Fri, Sep 14, 2018 at 8:23 PM Walt Karas <wk...@oath.com.invalid>
> wrote:
> >
> >> It looks to me like the AcidPtr docs need a prominent waring that a
> >> thread should have two instances of these (or AcidCommitPtr) in
> >> existence at the same time.  If the addresses of the two protected
> >> objects hashed to the same mutex, wouldn't it cause the thread to lock
> >> up (due to trying to lock the same mutex twice)?  If this did happen,
> >> it would be very hard to debug.
> >>
> >
> >
> > --
> > Aaron Canary
> > ATS - Senior Software Engineer
>



-- 
Derek

Re: Possible thread lockup due to AcidPtr?

Posted by Walt Karas <wk...@oath.com.INVALID>.
The assert would be good but I think the docs need a warning that two
AcidPtr instances or two AcidCommitPtr instances should not exist at
the same time in the same thread.

On Mon, Sep 17, 2018 at 1:36 PM, Aaron Canary <ac...@oath.com.invalid> wrote:
> yes. I had considered using a recursive mutex to handle this case. I chose
> not to support it because locking multiple things and write to them at
> the same time is against the spirit of ACID style databases.
>
> I suppose I could add an assert when a lock is waiting on a mutex owned by
> the same thread.
>
> On Fri, Sep 14, 2018 at 8:23 PM Walt Karas <wk...@oath.com.invalid> wrote:
>
>> It looks to me like the AcidPtr docs need a prominent waring that a
>> thread should have two instances of these (or AcidCommitPtr) in
>> existence at the same time.  If the addresses of the two protected
>> objects hashed to the same mutex, wouldn't it cause the thread to lock
>> up (due to trying to lock the same mutex twice)?  If this did happen,
>> it would be very hard to debug.
>>
>
>
> --
> Aaron Canary
> ATS - Senior Software Engineer

Re: Possible thread lockup due to AcidPtr?

Posted by Aaron Canary <ac...@oath.com.INVALID>.
yes. I had considered using a recursive mutex to handle this case. I chose
not to support it because locking multiple things and write to them at
the same time is against the spirit of ACID style databases.

I suppose I could add an assert when a lock is waiting on a mutex owned by
the same thread.

On Fri, Sep 14, 2018 at 8:23 PM Walt Karas <wk...@oath.com.invalid> wrote:

> It looks to me like the AcidPtr docs need a prominent waring that a
> thread should have two instances of these (or AcidCommitPtr) in
> existence at the same time.  If the addresses of the two protected
> objects hashed to the same mutex, wouldn't it cause the thread to lock
> up (due to trying to lock the same mutex twice)?  If this did happen,
> it would be very hard to debug.
>


-- 
Aaron Canary
ATS - Senior Software Engineer