EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  <20202021  2022  2023  2024  Index 2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  <20202021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: thread joinable race
From: Michael Davidsaver via Core-talk <core-talk at aps.anl.gov>
To: Ralph Lange <ralph.lange at gmx.de>, EPICS Core Talk <core-talk at aps.anl.gov>
Date: Mon, 9 Mar 2020 09:28:03 -0700
On 3/9/20 3:59 AM, Ralph Lange via Core-talk wrote:
> On Mon, 9 Mar 2020 at 06:47, Michael Davidsaver via Core-talk <core-talk at aps.anl.gov <mailto:core-talk at aps.anl.gov>> wrote:
> 
>     In following up on a strange CI test failure I noticed during the recent codeathon[1]
>     I realized a mistake I made in adding epicsThreadMustJoin() [2].  This change
>     introduced a reference counter to struct epicsThreadOSD.  The bug is in
>     (conditionally) incrementing the ref counter after pthread_create().
>     This allows a short-lived thread which attempts to self-join to race for a double free().
>     And it happens that epicsThreadTest does this.
> 
>     The fix is I think straight forward [3].  I'm wondering how severe this issue should be considered?
>     It's a race which can cause a crash at runtime.  However, the circumstances seem not so common.
> 
> 
> Well spotted!
> 
> Given that "a short-lived thread which attempts to self-join" is not a common situation, especially as this API was added very recently, I would suggest creating a regular LP ticket and fix the bug with the next release. Maybe step up the ticket priority to indicate that the issue might cause crashes.

https://bugs.launchpad.net/bugs/1866651

The caveat to this being a recently added API is that I wired
it into the epicsThread class.  Though I also don't think this
situation is likely to occur in the wild with c++ either.

I used the same design for the WIN32 version of epicsThreadMustJoin()
which will need an analogous change.  appveyor is churning through
this now.

Attachment: signature.asc
Description: OpenPGP digital signature


References:
thread joinable race Michael Davidsaver via Core-talk
Re: thread joinable race Ralph Lange via Core-talk

Navigate by Date:
Prev: [Bug 1866651] Re: thread joinable race mdavidsaver via Core-talk
Next: Build failed: EPICS Base base-7.0-559 AppVeyor via Core-talk
Index: 2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  <20202021  2022  2023  2024 
Navigate by Thread:
Prev: Re: thread joinable race Ralph Lange via Core-talk
Next: Build failed: epics-base base-integration-424 AppVeyor via Core-talk
Index: 2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  <20202021  2022  2023  2024 
ANJ, 09 Mar 2020 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·