Improve logging for wfShellExec() and ignore missing cgroup
authorTim Starling <tstarling@wikimedia.org>
Tue, 22 Oct 2013 01:16:14 +0000 (12:16 +1100)
committerTim Starling <tstarling@wikimedia.org>
Mon, 28 Oct 2013 21:14:09 +0000 (21:14 +0000)
commite53af95c9301ca092ffa1f7de022beb24d60ea52
treeec7e0a855ef32cafa2ef080ff56b60e60926b568
parentb071c709d8798b1653d31288a977cc62b7f38e67
Improve logging for wfShellExec() and ignore missing cgroup

Allow limit.sh to log its errors to an MW debug log channel, by opening
a separate FD for private communication.

Ensure that the log FD is always closed (3>&-) before executing a
subprocess, so that MW will not hang waiting for background processes
to close the log FD. This means using a fixed FD number, since the bash
syntax for closing a file requires a literal FD number.

The "exec" debug channel is now intended for production monitoring. In
addition to errors from limit.sh, it also records when a subprocess is
terminated by a signal.

The case where stream_select() returns false was tested by patching PHP
to inject EINTR or EBADF into errno.

When wfShellExec() is used with a memory cgroup, and the cgroup is missing, log and continue with no cgroup instead of immediately exiting.

Bug: 55709
Change-Id: Ie40befe9c0d00c9a0ddb01077df4afb774d17e15
includes/GlobalFunctions.php
includes/limit.sh