[RFC][PATCH v2 1/2][PR gdb/24069] [delete] Not-so-harmless spurious call to `wait4`

Simon Marchi simon.marchi@polymtl.ca
Sat Feb 19 16:02:04 GMT 2022


On 2022-02-19 10:57, Philippe Blain wrote:
> Hi Simon,
> 
> Le 2022-02-19 à 10:47, Simon Marchi a écrit :
>> On 2022-02-16 09:15, Philippe Blain wrote:
>>> From: Dominique Quatravaux <dominique.quatravaux@epfl.ch>
>>>
>>> As seen in https://sourceware.org/bugzilla/show_bug.cgi?id=24069 this
>>> code will typically wait4() a second time on the same process that was
>>> already wait4()'d a few lines above. While this used to be
>>> harmless/idempotent (when we assumed that the process already exited),
>>> this now causes a deadlock in the WIFSTOPPED case.
>>>
>>> The early (~2019) history of bug #24069 cautiously suggests to use
>>> WNOHANG instead of outright deleting the call. However, tests on the
>>> current version of Darwin (Big Sur) demonstrate that gdb runs just
>>> fine without a redundant call to wait4(), as would be expected.
>>> Notwithstanding the debatable value of conserving bug compatibility
>>> with an OS release that is more than a decade old, there is scant
>>> evidence of what that double-wait4() was supposed to achieve in the
>>> first place - A cursory investigation with `git blame` pinpoints
>>> commits bb00b29d7802 and a80b95ba67e2 from the 2008-2009 era, but
>>> fails to answer the “why” question conclusively.
>>
>> Given that this additional wait does not seem logical at all and
>> empirical evidence shows that it's not right, I'm fine with merging
>> this one directly.  Do you have push access, or would you like me to do
>> it on your behalf?
>>
>> Simon
>>
> 
> I do not have push access, so yes, if you think that it's a good idea to merge
> this one directly, please go ahead. I think it won't solve all problems on its
> own, but the bugzilla history indicates it would at least be a good start.

Thanks, will push.

> I did include a changelog entry, so that it could also be included in an eventual 
> 11.3 release if you think it makes sense.

There likely won't be a 11.3 release.  But if downstream ports are
building off the gdb-11-branch and it would be helpful for the fix to be
there, then I can always push it there, just let me know.

Simon


More information about the Gdb-patches mailing list