about summary refs log tree commit homepage
path: root/lib/PublicInbox/Spawn.pm
DateCommit message (Collapse)
2016-12-26spawn: remove non-blocking support, here
It is never used, and inappropriate to support in generic code. HTTPD::Async already sets non-blocking, and it's better to do it in -httpd-specific code since we know our -httpd can handle it.
2016-06-21spawn: improve error checking for fork failures
fork failures are unfortunately common when Xapian has gigabytes and gigabytes mmapped.
2016-06-18spawn: try to keep signals blocked in spawned child
While we only want to stop our daemons and gracefully destroy subprocesses, it is common for 'Ctrl-C' from a terminal to kill the entire pgroup. Killing an entire pgroup nukes subprocesses like git-upload-pack breaks graceful shutdown on long clones. Make a best effort to ensure git-upload-pack processes are not broken when somebody signals an entire process group. Followup-to: commit 37bf2db81bbbe114d7fc5a00e30d3d5a6fa74de5 ("doc: systemd examples should only kill one process")
2016-05-22spawn: note we do not use absolute paths within our code
We can't rely on absolute paths when installed on other systems. Unfortunately, mlmmj-* requires them, but none of the core code will use it.
2016-05-02spawn: proper signal handling for vfork
We cannot afford to fire Perl-level signal handlers in the vforked child process since they're not designed to run in the child like that. Thus we need to block all signals before calling vfork, reset signal dispositions in the child, and restore the signal mask in the parent. ref: https://ewontfix.com/7
2016-02-29favor procedural calls for most private functions
This makes for better compile-time checking and also helps document which calls are private for HTTP and NNTP. While we're at it, use IO::Handle::* functions procedurally, too, since we know we're working with native glob handles.
2016-02-28reduce calls to close unless error checks are needed
We can rely on timely auto-destruction based on reference counting; reducing the chance of redundant close(2) calls which may hit the wront FD. We do care about certain close calls (e.g. writing to a buffered IO handle) if we require error-checking for write-integrity. In other cases, let things go out-of-scope so it can be freed automatically after use.
2016-02-28spawn: disable popen optimization for non-vfork
This is necessary since we want to be able to do arbitrary redirects via the popen interface. Oh well, we'll be a little slower for now for users without vfork. vfork users will get all the performance benefits.
2016-02-27spawn: fail properly if Inline fails
We must stash the error correctly when nesting evals, oops :x
2016-02-27git: use built-in spawn implementation for vfork
This should reduce overhead of spawning git processes from our long-running httpd and nntpd servers.
2016-02-27initial spawn implementation using vfork
Under Linux, vfork maintains constant performance as parent process size increases. fork needs to prepare pages for copy-on-write, requiring a linear scan of the address space.