Rocky
Rocky

Reputation: 5716

How to check where the Apache2 hangs?

My Apache2 hangs. I can't get any response from it.

I tried to run wget localhost

it just hangs like this:

--2012-03-12 06:36:40--  http://localhost/
Resolving localhost... 127.0.0.1
Connecting to localhost|127.0.0.1|:80... connected.
HTTP request sent, awaiting response...

How can I get more debug information?

Upvotes: 4

Views: 12014

Answers (2)

Kaz
Kaz

Reputation: 58578

Use netstat -nt to see what connections there are to port 80 from 127.0.0.1.

You can use fuser -n tcp 80,127.0.0.1,<port-number> to look for the PID of the Apache process which has port 80 TCP connection from 127.0.0.1 from the given .

Then do an strace -p <pid> on that process to see what it's doing at the system call level.

You can take out the pid-finding steps if you restart Apache in single-process mode (provided that the hang still reproduces!) If that were the case I would just run that Apache under strace and capture the trace.

Based on that I would decide what to do next. Is it hanging in a syscall, not hanging in a syscall, ... which syscall. Last resorts would be getting a debugging build and gdb-ing it.

Apache debugging guide: http://httpd.apache.org/dev/debugging.html

Upvotes: 4

hobbes3
hobbes3

Reputation: 30218

Try tail -f /var/log/apache/error_log.

Your path to the error_log may be different. To search for it, try find / -name error_log. If you're not logged in as root then you may see a bunch of "permission denied". In that case you can hide the error messages with find / -name error_log 2>/dev/null or try to guess the location with find /var/log/ -name error_log.

Upvotes: 1

Related Questions