early this morning there was a log rotation, the last line in the apache error log was:
[error] (9)Bad file descriptor: apr_socket_accept: (client socket) apache2: Syntax error on line 250 of /etc/apache2/apache2.conf: Syntax error on line 1 of /etc/apache2/mods-enabled/alias.load: Cannot load /usr/lib/apache2/modules/mod_alias.so into server: /usr/lib/apache2/modules/mod_alias.so: failed to map segment from shared object: Cannot allocate memory
Apache failed to auto reload after this. When I got around to looking at this an hour or so later, i simply did an apache restart and everything was fine. It did leave a warning in the new log file:
[warn] pid file /var/run/apache2.pid overwritten -- Unclean shutdown of previous Apache run?
What does this mean, and how can I correct what ever went wrong?
(Apache/2.2.22 (Debian))
edit or if this is not something that can be fixed, is there a way of getting apache to auto reload x qty of times before giving up (like pm2 with node)?
An inability to allocate shared memory is a special kind of beast. It doesn't mean that the system as a whole is out of memory, but instead that you've hit one of the limits that govern shared memory allocation.
The two relevant sysctls are
kernel.shmmax
(which is the limit, in bytes, on how large a single shared memory segment can be) andkernel.shmall
(which is the total amount of shared memory, in bytes, that can be allocated to the system). Usegrep Shmem /proc/meminfo; cat /proc/sys/kernel/shmall
to visualize these amounts.You can tell whether
shmall
has been hit by comparing theShmem
line of/proc/meminfo
against/proc/sys/kernel/shmall
. If they're about equal, then you've hit the system-wide shared memory limit, and will need to increasekernel.shmall
(or stop something that's got shared memory in use). Otherwise, you'll probably need to increasekernel.shmmax
to something larger than whatever the process that's failing wants to use.