[Haskell-cafe] Discussion: The CLOEXEC problem

Mike Meyer mwm at mired.org
Sun Aug 30 13:53:12 UTC 2015


On Sun, Aug 30, 2015 at 9:19 AM Alexander Kjeldaas <
alexander.kjeldaas at gmail.com> wrote:

> The directory is irrelevant.  fork() + exec() is not an atomic operation:
>

This creates problems for all resources that act as locks. IIRC (it's been
a few years since I looked through it thoroughly), it's been shown that
there isn't a general fix for this. I.e - that the POSIX threading model &
fork()  will having timing issues of some sort or another no matter what
you do. The work-around is to only fork when no such resources are held. So
you do things like fork all your processes before starting a thread, or
fork a server that will do all further forks upon request before starting a
thread, etc.

So the question should not be whether CLO_EXEC "fixes everything", but
whether having it as the default is a good enough idea to be worth the pain
of changing. I suspect the answer is yes, as most cases where it isn't set
are probably because it's the default, so won't need changing.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20150830/d92e1818/attachment.html>


More information about the Haskell-Cafe mailing list