You are not logged in.

#1 2018-07-09 01:29:29

Bachsau
Member
Registered: 2016-12-09
Posts: 10

Stopping Apache 2 running as my desktop user kills whole session

Hi, I'm experiencing some strange behaviour that I seem unable to find the cause for.

For testing purposes I installed the Apache 2 webserver on my desktop machine, not running it as a systemd service but under my default user account instead, whenever I need it.

To start the server I call this command:

/usr/bin/httpd -d "$HOME/Webserver" -f "$HOME/Webserver/httpd.conf" -DFOREGROUND

To stop the server I append "-k stop" to it:

/usr/bin/httpd -d "$HOME/Webserver" -f "$HOME/Webserver/httpd.conf" -DFOREGROUND -k stop

Of course I created the corresponding configuration environment in mentioned directory. This used to work fine as long as I was using the event mpm. Now I enabled the prefork mpm instead and it started to behave strangely when calling the stop command: Instead of just stoping the webserver, it kicks me out of the whole desktop session. The logs show nothing but the default startup / shutdown messages.

Do you have any idea what's going on?

Offline

#2 2018-07-09 15:18:43

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 16,218

Re: Stopping Apache 2 running as my desktop user kills whole session

Are you using port 80?  If so, are you running httpd as root?


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way

Offline

#3 2018-07-09 15:56:50

Bachsau
Member
Registered: 2016-12-09
Posts: 10

Re: Stopping Apache 2 running as my desktop user kills whole session

As I already wrote in my first posting, I'm running it as my desktop user, as this is more convenient for testing, which in turn means I can't use port 80. It is configured to listen on 127.0.0.1:8080 and [::1]:8080 instead.

Offline

#4 2018-07-09 16:02:52

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 16,218

Re: Stopping Apache 2 running as my desktop user kills whole session

No problem.  My question was to establish whether you had run it is root.  Sometimes that has unexpected side effects.

I don't have httpd installed on my systems (I changed over to nginx).  Does it have a verbose option you can try?


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way

Offline

#5 2018-07-10 01:44:30

Bachsau
Member
Registered: 2016-12-09
Posts: 10

Re: Stopping Apache 2 running as my desktop user kills whole session

Unfortunately it does not log anything unusual, even when LogLevel is set to debug. I just tracked it down to using the -DFOREGROUND in combination with a .desktop starter. Really strange. Without -DFOREGROUND everything works fine, also when running with -DFOREGROUND and from a terminal window. Very strange...

Last edited by Bachsau (2018-07-10 01:45:37)

Offline

#6 2018-07-10 03:34:09

seth
Member
Registered: 2012-09-03
Posts: 8,663

Re: Stopping Apache 2 running as my desktop user kills whole session

Look at the process tree, the apache processes will likely be children of the session.
Question is whether they raise a SIGCHLD or your stopping routine is the problem,  what happens for "apachectl -k stop"?

Offline

#7 2018-07-10 16:08:45

Bachsau
Member
Registered: 2016-12-09
Posts: 10

Re: Stopping Apache 2 running as my desktop user kills whole session

They are children of whatever I used to start them, or at least, the master process is and it's spawn are children of it, just as it should be. apachectl does exactly the same thing, as it does nothing else but wrapping httpd, which in turn, is a compiled ELF binary as distributed by the package.

Offline

#8 2018-07-10 18:05:39

seth
Member
Registered: 2012-09-03
Posts: 8,663

Re: Stopping Apache 2 running as my desktop user kills whole session

What if you just kill the master process?
What if you disown the master process?
What happens to processes owned by your user running directly under PID 1?
What if you trap (and log) various signals in the parenting shell?

The principal question here would be whether the daemon fires up the termination or simply kills all PIDs of your user.

Offline

Board footer

Powered by FluxBB