Hi all, I haven't found a mention of this in the BTS and was wondering if anyone might be able to shed some light. With 'ash' installed, /bin/sh is symlinked to /bin/ash instead of the default of /bin/bash. This generally results in all sorts of interesting things as non-POSIX #!/bin/sh scripts start breaking. What's concerning me though is that piped logs in Apache are now spawning two processes per logfile directive, rather than just the one that I was seeing with bash as /bin/sh. For example: My virtual hosts currently talk to cronolog. CustomLog "|cronolog /var/log/apache/DOMAIN/%Y/%Y-%m-access.log" combined With ash as /bin/sh, we can see that there is a 'sh' forked for every 'cronolog'. (Dropping %CPU, %MEM, VSZ, RSS, TTY from 'ps fauxw' output.) root 28400 S Apr29 1:35 /usr/sbin/apache root 2102 SW 08:29 0:00 \_ [sh] root 2106 SW 08:29 0:00 | \_ [cronolog] root 2103 SW 08:29 0:00 \_ [sh] root 2107 SW 08:29 0:00 | \_ [cronolog] root 2104 SW 08:29 0:00 \_ [sh] root 2109 SW 08:29 0:00 | \_ [cronolog] root 2105 SW 08:29 0:00 \_ [sh] root 2112 SW 08:29 0:00 | \_ [cronolog] root 2108 SW 08:29 0:00 \_ [sh] root 2111 SW 08:29 0:00 | \_ [cronolog] root 2117 SW 08:29 0:00 \_ [sh] root 2123 SW 08:29 0:00 | \_ [cronolog] root 2118 SW 08:29 0:00 \_ [sh] root 2121 SW 08:29 0:00 | \_ [cronolog] root 2119 SW 08:29 0:00 \_ [sh] root 2127 SW 08:29 0:00 | \_ [cronolog] root 2122 SW 08:29 0:00 \_ [sh] root 2130 SW 08:29 0:00 | \_ [cronolog] root 2124 SW 08:29 0:00 \_ [sh] root 2132 SW 08:29 0:00 | \_ [cronolog] www-data 3844 S 13:01 0:01 \_ /usr/sbin/apache www-data 4018 S 13:37 0:00 \_ /usr/sbin/apache www-data 4040 S 13:42 0:00 \_ /usr/sbin/apache www-data 4063 S 13:49 0:00 \_ /usr/sbin/apache Putting bash back as /bin/sh and restarting apache gives us this: root 13125 S 15:23 0:41 /usr/sbin/apache root 13132 SW 15:24 0:00 \_ [cronolog] root 13133 SW 15:24 0:00 \_ [cronolog] root 13134 SW 15:24 0:00 \_ [cronolog] root 13135 SW 15:24 0:00 \_ [cronolog] root 13136 SW 15:24 0:00 \_ [cronolog] root 13138 SW 15:24 0:00 \_ [cronolog] root 13139 SW 15:24 0:00 \_ [cronolog] root 13140 SW 15:24 0:00 \_ [cronolog] root 13141 SW 15:24 0:00 \_ [cronolog] root 13142 SW 15:24 0:00 \_ [cronolog] www-data 13143 S 15:24 0:04 \_ /usr/sbin/apache www-data 13144 S 15:24 0:04 \_ /usr/sbin/apache www-data 13162 S 15:27 0:02 \_ /usr/sbin/apache I'm not enormously concerned (yet) with 2 processes being forked off for each log rather than 1, but was without nosing around in the source code I was wondering if anyone might know if Apache can either get ash to exec the piped log command (and thus not hang around) or can avoid invoking /bin/sh in the first place? I assume bash has some smarts in this regard that ash doesn't. Is there perhaps an assumption by Apache that forking off a shell to handle the external processes is safer than calling the process directly? If anyone has some suggestions to keep my httpd children process count of order N rather than 2N I'd be grateful. =) Andrew. -- Andrew Shugg <andrew@neep.com.au> http://www.neep.com.au/ "Just remember, Mr Fawlty, there's always someone worse off than yourself." "Is there? Well I'd like to meet him. I could do with a good laugh."
Attachment:
pgpc1bbVvZY9C.pgp
Description: PGP signature