Apache ã AH00144 ã§è½ã¡ãä»¶
äºè±¡
- Ubuntu 18.04
- apache2 (2.4.29-1ubuntu4.12)
ã§ãapache2 ããã»ã¹ã次ã®ã¨ã©ã¼ã¡ãã»ã¼ã¸ãåãã¦è½ã¡ãã¨ããé£çµ¡ãåãã¦èª¿ã¹ã¾ãããããã¯ãã®åå ã¨å¯¾å¦æ³ã®ã¡ã¢ã§ãã
[mpm_prefork:emerg] [pid 18633] (43)Identifier removed: AH00144: couldn't grab the accept mutex [mpm_prefork:emerg] [pid 18632] (43)Identifier removed: AH00144: couldn't grab the accept mutex [core:alert] [pid 18624] AH00050: Child 18632 returned a Fatal error... Apache is exiting! [:emerg] [pid 18624] AH02818: MPM run failed, exiting
åå
ç°¡åã«ããã¨ãApache ã Mutex ã«ä½¿ã£ã¦ããã»ããã©ã systemd-logind ãæ¶ãã¦ãã¾ãã®ãåå ã§ãã
Apache ã® Mutex
Mutex ãã£ã¬ã¯ãã£ã ã®ããã©ã«ã㯠Mutex default ã§ãã©ã®æ©æ§ãæ¡ç¨ãããã㯠APR ã«å§ãããã¦ãã¾ãã
ã©ã®æ©æ§ãæ¡ç¨ããããã¯ãã®ããã«ãã¦ç¢ºèªã§ãã¾ãã
$ cat mutex-default.c
#include <apr_portable.h>
int main(int argc, char** argv)
{
printf("%s\n", apr_proc_mutex_defname());
return 0;
}
$ gcc $(apr-config --includes) mutex-default.c $(apr-config --link-ld)
$ ./a.out
sysvsem
åå¨ãã IPC ã»ããã©ãªã©ã®ç¢ºèªã¯ ipcs ã³ãã³ãã§ã§ãã¾ãã
Apache ãèµ·åãã¦ããã°ãã»ããã©ãããã¤ã表示ãããã¯ãã§ãã
$ ipcs -a ------ Message Queues -------- key msqid owner perms used-bytes messages ------ Shared Memory Segments -------- key shmid owner perms bytes nattch status ------ Semaphore Arrays -------- key semid owner perms nsems 0x00000000 5111808 gyoza 600 1 0x00000000 5144577 gyoza 600 1 0x00000000 5046274 gyoza 600 1 0x00000000 5177347 gyoza 600 1 0x00000000 5210116 gyoza 600 1
systemd-logind ã® RemoveIPC
systemd-logind ã¯ããã©ã«ãã§ RemoveIPC=yes ã«ãªã£ã¦ãã¾ãã
RemoveIPC ã¨ã¯ logind.conf(5) ã«ããã°æ¬¡ã®ããã«èª¬æããã¦ãã¾ãã
RemoveIPC= Controls whether System V and POSIX IPC objects belonging to the user shall be removed when the user fully logs out. Takes a boolean argument. If enabled, the user may not consume IPC resources after the last of the user's sessions terminated. This covers System V semaphores, shared memory and message queues, as well as POSIX shared memory and message queues. Note that IPC objects of the root user and other system users are excluded from the effect of this setting. Defaults to "yes".
ã¤ã¾ãã
- logind 管çä¸ã®ã»ãã·ã§ã³ãå ¨ã¦ãªããªãã¨ãã«ããã®ã¦ã¼ã¶ã¼ã® IPC ã»ããã©ãªã©ãå ¨ã¦åé¤ãã
- ãã ããroot ã¨ã·ã¹ãã ã¦ã¼ã¶ã¼ã¯é¤å¤ããã
ã¨ãããã¨ã§ãã
ã·ã¹ãã ã¦ã¼ã¶ã¼ã¨ã¯ã uid ã 999 以ä¸ã®ã¦ã¼ã¶ã¼ã®ãã¨ã§ãã
åç¾æ¹æ³
- Apache ãéã·ã¹ãã ã¦ã¼ã¶ã¼ (uid ã 1000 以ä¸) ã§èµ·åãã â ã»ããã©ãä½ããã)
- ãã®éã·ã¹ãã ã¦ã¼ã¶ã¼ã§ SSH ãã°ã¤ã³ãã
- ãã°ã¢ã¦ããã â ã»ããã©ãæ¶ããã
- Apache ã«ãªã¯ã¨ã¹ããæ¥ãã¨ããã»ã¹ãæ»ã¬
ããã§åç¾ãã¾ãã
é常㯠Apache ã¯ã·ã¹ãã ã¦ã¼ã¶ã§ãã www-data ã®æ¨©éã§èµ·åãããã®ã§ãã®åé¡ã¯çºçãã¾ãããããã®ç°å¢ã§ã¯æ·±æ·µãªçç±ã§éã·ã¹ãã ã¦ã¼ã¶ã¼ã§èµ·åãã¦ãã¾ããã
坾妿³
å 製ã®ãã¼ã¢ã³ã§ IPC ã使ã£ã¦ããã¨åãããã«ããããããªã®ã§ãå¾è ã®å¯¾å¦æ³ãæ¡ç¨ãã¾ããã
Apache ã§ã»ããã©ã§ã¯ãªã Mutex ã使ã
Mutex file:/var/lock/apache2 default
systemd-logind ã§ IPC ãæ¶ããªãããã«ãã
# install -d -o root -g root -m 755 /etc/systemd/logind.conf.d/ # cat << EOF > /etc/systemd/logind.conf.d/ipc.conf [Login] RemoveIPC=no EOF # systemctl restart systemd-logind.service