public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug nptl/14499] New: Does posix_spawn invoke atfork handlers / use vfork?
@ 2012-08-20 22:24 luto at mit dot edu
  2012-08-20 22:28 ` [Bug nptl/14499] " luto at mit dot edu
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: luto at mit dot edu @ 2012-08-20 22:24 UTC (permalink / raw)
  To: glibc-bugs

http://sourceware.org/bugzilla/show_bug.cgi?id=14499

             Bug #: 14499
           Summary: Does posix_spawn invoke atfork handlers / use vfork?
           Product: glibc
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: nptl
        AssignedTo: unassigned@sourceware.org
        ReportedBy: luto@mit.edu
                CC: drepper.fsp@gmail.com
    Classification: Unclassified


The resolution of bug 378 indicates that glibc's (NPTL) posix_spawn calls
atfork handlers.  This means that posix_spawn can't use vfork (or fancy clone
options), which makes it slow.  (Note that, AFAICT, this behavior is not
documented anywhere, despite being implementation-specified.)

This was apparently true when bug 378 was closed, but it changed in commit
a9f43ef464f71b0d379524b2a6294092332c9a30.  The current behavior is bizarre. 
See the attached code, which invokes atfork handlers only on the second
posix_spawn call.

IMO the right fix is to never invoke atfork handlers (since presumably nothing
relies on them getting called, since they haven't been reliably called since
2005).  That way vfork can be used unconditionally, which is faster.

See also bug 10354, which does not have a resolution that I understand.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug nptl/14499] Does posix_spawn invoke atfork handlers / use vfork?
  2012-08-20 22:24 [Bug nptl/14499] New: Does posix_spawn invoke atfork handlers / use vfork? luto at mit dot edu
@ 2012-08-20 22:28 ` luto at mit dot edu
  2012-08-21 13:43 ` bugdal at aerifal dot cx
  2014-06-17  5:57 ` fweimer at redhat dot com
  2 siblings, 0 replies; 4+ messages in thread
From: luto at mit dot edu @ 2012-08-20 22:28 UTC (permalink / raw)
  To: glibc-bugs

http://sourceware.org/bugzilla/show_bug.cgi?id=14499

--- Comment #1 from Andy Lutomirski <luto at mit dot edu> 2012-08-20 22:28:07 UTC ---
Created attachment 6593
  --> http://sourceware.org/bugzilla/attachment.cgi?id=6593
Example of atfork inconsistency

[There's something wrong with the bugzilla login process, so my attachment got
dropped.  Oops.]

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug nptl/14499] Does posix_spawn invoke atfork handlers / use vfork?
  2012-08-20 22:24 [Bug nptl/14499] New: Does posix_spawn invoke atfork handlers / use vfork? luto at mit dot edu
  2012-08-20 22:28 ` [Bug nptl/14499] " luto at mit dot edu
@ 2012-08-21 13:43 ` bugdal at aerifal dot cx
  2014-06-17  5:57 ` fweimer at redhat dot com
  2 siblings, 0 replies; 4+ messages in thread
From: bugdal at aerifal dot cx @ 2012-08-21 13:43 UTC (permalink / raw)
  To: glibc-bugs

http://sourceware.org/bugzilla/show_bug.cgi?id=14499

Rich Felker <bugdal at aerifal dot cx> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugdal at aerifal dot cx

--- Comment #2 from Rich Felker <bugdal at aerifal dot cx> 2012-08-21 13:43:08 UTC ---
Indeed, while POSIX allows posix_spawn to call atfork handlers, this allowance
is only for the sake of implementations that can't avoid it. Calling them is
purely malevolent; it introduces opportunities for atfork-related race
conditions (like the infamous malloc/fork issue) and seriously degrades
performance by disallowing vfork and just from the overhead (usually heavy
synchronization overhead) in the atfork handlers.

Also, since posix_spawn is intended to be added to the list of
async-signal-safe functions in the next version of POSIX, this allowance is
surely going to vanish. It would benefit glibc to be ahead of the game and go
ahead and eliminate it.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug nptl/14499] Does posix_spawn invoke atfork handlers / use vfork?
  2012-08-20 22:24 [Bug nptl/14499] New: Does posix_spawn invoke atfork handlers / use vfork? luto at mit dot edu
  2012-08-20 22:28 ` [Bug nptl/14499] " luto at mit dot edu
  2012-08-21 13:43 ` bugdal at aerifal dot cx
@ 2014-06-17  5:57 ` fweimer at redhat dot com
  2 siblings, 0 replies; 4+ messages in thread
From: fweimer at redhat dot com @ 2014-06-17  5:57 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=14499

Florian Weimer <fweimer at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |fweimer at redhat dot com
              Flags|                            |security-

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-06-17  5:57 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-08-20 22:24 [Bug nptl/14499] New: Does posix_spawn invoke atfork handlers / use vfork? luto at mit dot edu
2012-08-20 22:28 ` [Bug nptl/14499] " luto at mit dot edu
2012-08-21 13:43 ` bugdal at aerifal dot cx
2014-06-17  5:57 ` fweimer at redhat dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).