Manual:$wgShellCgroup/ja

Under Linux: a cgroup directory used to constrain memory usage of shell commands. ディレクトリは、MediaWiki を実行している利用者が書き込めるようにしてください.

If specified, this is used instead of ulimit, which is inaccurate, and causes malloc to return NULL, which exposes bugs in C applications, making them segfault or deadlock.

A wrapper script will create a cgroup for each shell command that runs, as a subgroup of the specified cgroup. If the memory limit is exceeded, the kernel will send a SIGKILL signal to a process in the subgroup. (MediaWiki will often report this error as error code 137, after the bash return status of a command receiving SIGKILL)

セットアップ
cgroup をセットアップしていない場合は、cgroup ファイルシステムをマウントする必要がある場合があります. root として以下を実行します:

mount -t tmpfs cgroup_root /sys/fs/cgroup mkdir /sys/fs/cgroup/memory mount -t cgroup cgroup_memory -omemory /sys/fs/cgroup/memory

Next you need to do MediaWiki specific configuration:

mkdir -p /sys/fs/cgroup/memory/mediawiki mkdir -m 0777 /sys/fs/cgroup/memory/mediawiki/job

The reliability of cgroup cleanup can be improved by installing a notify_on_release script in the root cgroup (This step is optional).

echo "/usr/local/bin/cgroup-mediawiki-clean" > /sys/fs/cgroup/memory/release_agent
 * Copy to /usr/local/bin/cgroup-mediawiki-clean
 * 以下のコマンドを実行します:

Last of all, enable cgroups in your echo '$wgShellCgroup = "/sys/fs/cgroup/memory/mediawiki/job";' >> LocalSettings.php

The reliability of cgroup cleanup can be improved by installing a notify_on_release script in the root cgroup, see e.g. 40784

トラブルシューティング
cgroups が動作しない場合は、以下をお試しください:


 * cgroup-bin パッケージをインストールします
 * コマンド  を実行します.  If the memory subsystem has a 0 under enabled, then memory cgroups may be disabled in your kernel. Try rebooting your computer with   on the kernel command line.
 * Older bash doesn't like the readarray call in limit.sh. 少なくともバージョン 4.1 を使用すべきです

関連項目

 * shell script
 * cgroup documentation in the Linux kernel
 * shell script
 * cgroup documentation in the Linux kernel
 * cgroup documentation in the Linux kernel
 * cgroup documentation in the Linux kernel