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.
Cheers,
~Ralph