You are not logged in.

#1 2014-01-02 04:09:34

Totony
Member
Registered: 2011-07-26
Posts: 16

httpd systemd service seems to start multiple instances

Hi,

I've been trying to get more into systemd and I come across a problem: when I try to start httpd using the default service for httpd (/usr/lib/systemd/system/httpd.service) and try to see the status of httpd, I see that it is started 7 times

[root]# httpd -k start
[root]# ps -e | grep httpd
1234 1234 httpd
[root]# httpd -k stop
[root]# systemctl start httpd
[root]# ps -e | grep httpd
1234 1234 httpd
1235 1234 httpd
1236 1234 httpd
1237 1234 httpd
1238 1234 httpd
1239 1234 httpd
1240 1234 httpd
1241 1234 httpd

The configuration file (/usr/lib/systemd/system/httpd.service) is :

[Unit]
Description=Apache Web Server
After=network.target remote-fs.target nss-lookup.target

[Service]
Type=forking
PIDFile=/var/run/httpd/httpd.pid
ExecStart=/usr/sbin/apachectl start
ExecStop=/usr/sbin/apachectl graceful-stop
ExecReload=/usr/sbin/apachectl graceful
PrivateTmp=true
LimitNOFILE=infinity

[Install]
WantedBy=multi-user.target
[root]# systemctl status httpd
[...]
Process: 1234 ExecStart=/usr/sbin/apachectl start (code=exited, status=0/SUCCESS)
MainPID: 1234 (httpd)
CGroup: /system.lice/httpd.service
| -1234 /usr/bin/httpd -k start
| -1235 /usr/bin/httpd -k start
| -1236 /usr/bin/httpd -k start
| -1237 /usr/bin/httpd -k start
| -1238 /usr/bin/httpd -k start
| -1239 /usr/bin/httpd -k start
| -1240 /usr/bin/httpd -k start
| -1241 /usr/bin/httpd -k start

Starting Apache Web Server...
PID file /run/httpd/httpd.pid not readable (yet?) after start.
Started Apache Web Server.

Would anyone know what causes this result? Also, is there any way I could inquire the systemd journal to debug more this problem?

Offline

#2 2014-01-02 04:32:09

freebullets
Member
Registered: 2011-11-10
Posts: 31

Re: httpd systemd service seems to start multiple instances

That's working as intended. Apache spawns multiple processes. It's not systemd malfunctioning.

Offline

#3 2014-01-04 05:09:11

Totony
Member
Registered: 2011-07-26
Posts: 16

Re: httpd systemd service seems to start multiple instances

freebullets wrote:

That's working as intended. Apache spawns multiple processes. It's not systemd malfunctioning.

But why would it need to spawn multiple processes when started by systemd and not when started manually?

Offline

#4 2014-02-07 02:42:30

amckee
Member
From: Cruise Ship Earth
Registered: 2012-02-13
Posts: 25
Website

Re: httpd systemd service seems to start multiple instances

[root]# ps -e | grep httpd
1234 1234 httpd
1235 1234 httpd
1236 1234 httpd
1237 1234 httpd
1238 1234 httpd
1239 1234 httpd
1240 1234 httpd
1241 1234 httpd

Your ps headers aren't there, but it looks like the columns are 'pid' 'ppid' 'name'   If this is the case, then these are threads, created by the parent pid of 1234, though these numbers look modified. Getting a pid of 1234 is quite lucky.

If this is the case then it's not spawning procs, but threads and is normal. Why they don't appear when manually started may be a configuration thing, as in it loads a different config file. What command do you use to start it manually?

Offline

Board footer

Powered by FluxBB