tech-kern archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: using of fork() in multithreaded application
Jörg Sonnenberger <joerg%bec.de@localhost> writes:
> On 1/24/25 1:27 PM, Greg Troxel wrote:
>> Taylor R Campbell <riastradh%NetBSD.org@localhost> writes:
>>
>>>> Date: Wed, 22 Jan 2025 16:47:13 +0100
>>>> From: Peter Skvarka <ps%softinengines.com@localhost>
>>>>
>>>> I have two questions:
>>>> Is safe using of fork() in NetBSD 10.1 in mutlithreaded application ?
>>>
>>> Generally yes, with the caveat that it is difficult for applications
>>> to use correctly.
>> In 2010ish I saw a hard-to-find bug, the details of which are now
>> fading
>> from memory. I think it was some kind of lock taken in a routine that
>> was called after fork and before exec. I think the program was python
>> and the lock was in libc's malloc. (This would have NetBSD 5 or 6.)
>
> I've fixed various issues in libc to make fork-without-exec reasonable
> reliable for many use cases. malloc certainly was one of them.
That's great to hear. Certainly it's nicer if our system is more likely
to work when faced with out-of-spec behavior but it's still wrong of
programs to use malloc after fork and before exec.
Home |
Main Index |
Thread Index |
Old Index