apache error (98)Address already in use

Installing, Configuring, Troubleshooting server daemons such as Web and Mail
supportadl
Posts: 34
Joined: 2010/03/01 14:59:22

apache error (98)Address already in use

Post by supportadl » 2012/03/22 17:21:06

Hello All !! I have a problem on a server running Centos 5.8, Apache 2.2.3 and Virtualmin 3.90. This is a public server used to host websites and Dns server.
Every week, it seems to be every 7 days, Apache crash in the night. When I try to start the service I receive this error:

starting httpd: (98)Address already in use: make_sock: could not bind to address [::]:80
(98)Address already in use: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
Unable to open logs
[FAILED]

I need to restart the server and then Apache work correctly for 1 week. Now I set a cron job that restart the server every night but I need to resolve this issue.

During the night I have only backup jobs and "/etc/webmin/webalizer/webalizer.pl" jobs working.

Can anyone help me?

Thanks!!

pschaff
Retired Moderator
Posts: 18276
Joined: 2006/12/13 20:15:34
Location: Tidewater, Virginia, North America
Contact:

apache error (98)Address already in use

Post by pschaff » 2012/03/23 01:48:24

Have you checked the logs for any messages before the time of the crash? Any cron jobs running weekly, including /etc/cron.weekly/?

shanna_doll
Posts: 2
Joined: 2012/03/23 09:31:46
Contact:

Re: apache error (98)Address already in use

Post by shanna_doll » 2012/03/23 09:35:55

This sounds awkward but check your virtual hosts and addresses again..

supportadl
Posts: 34
Joined: 2010/03/01 14:59:22

Re: apache error (98)Address already in use

Post by supportadl » 2012/03/23 14:58:55

I have this cron jobs running weekly on Sunday but the problem happen usually during the week:
/etc/cron.weekly/99-raid-check
/etc/cron.weekly/0anacron
/etc/cron.weekly/makewhatis.cron

Sorry but I have no log from Tuesday March 20th 19:39:04 until the restart in the morning of Wednesday 21 March. I'm looking into "/etc/httpd/logs/error_log". Can I take a look in other log files?

I think Apache does'nt start if there is a bad configuration of virtual host and addresses. I have all virtual server running well on port 80.

Thanks for you help.

pschaff
Retired Moderator
Posts: 18276
Joined: 2006/12/13 20:15:34
Location: Tidewater, Virginia, North America
Contact:

Re: apache error (98)Address already in use

Post by pschaff » 2012/03/23 15:02:00

Check /var/log/messages. I have no idea what could change the addresses for virtual hosts. Is it possible some other machine or virtual host is improperly using the same address?

supportadl
Posts: 34
Joined: 2010/03/01 14:59:22

Re: apache error (98)Address already in use

Post by supportadl » 2012/03/23 15:17:47

I have only "named" logs in /var/log/messages. And nothing strange.
This is a standalone Virtual Machine running behind a firewall. There are no other machines.

How can I check if Apache configurazione is correct? What parametres can I start to check? I'm using Webmin interface to manage this server.

Thanks.

supportadl
Posts: 34
Joined: 2010/03/01 14:59:22

Re: apache error (98)Address already in use

Post by supportadl » 2012/04/04 13:38:48

Hello! This morning error appear again. I launch this command "netstat -anp --tcp --udp | grep LISTEN" and see "httpd" process running on port 80 and 443

tcp 0 0 :::80 :::* LISTEN 6014/httpd

tcp 0 0 :::443 :::* LISTEN 6014/httpd

but I receive the same error if I try to restart the service.

"Avvio di httpd: (98)Address already in use: make_sock: could not bind to address [::]:80
(98)Address already in use: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
Unable to open logs"

Using "top" command I see "httpd" process running, I killed it with command "kill -9 6014" and then start apache correctly.

Unfortuantely I have no log regarding Apache crash.

Do you have any idea?

Thanks a lot.

pschaff
Retired Moderator
Posts: 18276
Joined: 2006/12/13 20:15:34
Location: Tidewater, Virginia, North America
Contact:

Re: apache error (98)Address already in use

Post by pschaff » 2012/04/04 15:19:23

If the processes are running, and there is nothing in the logs, what leads you to conclude that Apache has crashed? I google on the [url=https://www.google.com/search?q=apache+OR+httpd+%22Address+already+in+use%3A+make_sock%3A+could+not+bind+to+address+%22&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-US:unofficial&client=firefox-a]error when you attempt to restart[/url] may give some clues. One post in [url=http://www.linuxquestions.org/questions/linux-networking-3/98-address-already-in-use-make_sock-could-not-bind-to-address-%5B-%5D-443-a-841030/]this thread[/url] mentions SSL misconfiguration as a cause.

supportadl
Posts: 34
Joined: 2010/03/01 14:59:22

Re: apache error (98)Address already in use

Post by supportadl » 2012/04/10 07:16:30

Hello Phil,
I will check thread you suggest in previous post but this morning I checked the server. Apache is running because I see my web sites but If I try to restart httpd service I receive the same error

"Avvio di httpd: (98)Address already in use: make_sock: could not bind to address [::]:80
(98)Address already in use: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
Unable to open logs"

Using Webmin console I see the service down but It's working for the moment.

I see this kind of logs in /etc/httpd/logs/error_log

[Wed Apr 04 15:29:31 2012] [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Wed Apr 04 15:29:31 2012] [notice] Digest: generating secret for digest authentication ...
[Wed Apr 04 15:29:31 2012] [notice] Digest: done
[Wed Apr 04 15:29:31 2012] [notice] mod_python: Creating 4 session mutexes based on 256 max processes and 0 max threads.
[Wed Apr 04 15:29:31 2012] [notice] Apache/2.2.3 (CentOS) configured -- resuming normal operations
--------
[Fri Apr 06 07:14:54 2012] [notice] caught SIGTERM, shutting down

[Fri Apr 06 08:14:02 2012] [warn] mod_fcgid: process 5103 graceful kill fail, sending SIGKILL

[Fri Apr 06 08:15:21 2012] [warn] mod_fcgid: process 5461 graceful kill fail, sending SIGKILL

[Fri Apr 06 08:16:04 2012] [warn] mod_fcgid: process 5499 graceful kill fail, sending SIGKILL

[Fri Apr 06 08:24:19 2012] [warn] mod_fcgid: process 5762 graceful kill fail, sending SIGKILL

[Fri Apr 06 08:46:54 2012] [warn] mod_fcgid: process 6530 graceful kill fail, sending SIGKILL

[Fri Apr 06 08:50:38 2012] [warn] mod_fcgid: process 6641 graceful kill fail, sending SIGKILL

[Fri Apr 06 10:35:31 2012] [warn] mod_fcgid: process 9991 graceful kill fail, sending SIGKILL

[Fri Apr 06 10:37:45 2012] [warn] mod_fcgid: process 6744 graceful kill fail, sending SIGKILL

[Fri Apr 06 10:40:36 2012] [warn] mod_fcgid: process 6778 graceful kill fail, sending SIGKILL

[Fri Apr 06 10:42:32 2012] [warn] mod_fcgid: process 10473 graceful kill fail, sending SIGKILL

[Fri Apr 06 10:48:27 2012] [warn] mod_fcgid: process 10666 graceful kill fail, sending SIGKILL

[Fri Apr 06 10:51:57 2012] [warn] mod_fcgid: process 10799 graceful kill fail, sending SIGKILL

[Fri Apr 06 11:05:56 2012] [warn] mod_fcgid: process 10859 graceful kill fail, sending SIGKILL

[Sun Apr 08 01:10:10 2012] [warn] mod_fcgid: cleanup zombie process 4043

[Sun Apr 08 01:10:10 2012] [warn] mod_fcgid: cleanup zombie process 4181

[Sun Apr 08 04:02:16 2012] [notice] SIGHUP received. Attempting to restart
-----------
[Sun Apr 08 04:02:17 2012] [notice] Digest: generating secret for digest authentication ...
[Sun Apr 08 04:02:17 2012] [notice] Digest: done
[Sun Apr 08 04:02:17 2012] [notice] mod_python: Creating 4 session mutexes based on 256 max processes and 0 max threads.
[Sun Apr 08 04:02:18 2012] [notice] Apache/2.2.3 (CentOS) configured -- resuming normal operations
[Sun Apr 08 04:02:19 2012] [notice] Graceful restart requested, doing restart
[Sun Apr 08 04:02:21 2012] [notice] Digest: generating secret for digest authentication ...
[Sun Apr 08 04:02:21 2012] [notice] Digest: done
[Sun Apr 08 04:02:21 2012] [notice] mod_python: Creating 4 session mutexes based on 256 max processes and 0 max threads.
[Sun Apr 08 04:02:21 2012] [notice] Apache/2.2.3 (CentOS) configured -- resuming normal operations
[Sun Apr 08 04:02:25 2012] [notice] Graceful restart requested, doing restart
[Sun Apr 08 04:02:29 2012] [notice] Digest: generating secret for digest authentication ...
[Sun Apr 08 04:02:29 2012] [notice] Digest: done
[Sun Apr 08 04:02:30 2012] [notice] mod_python: Creating 4 session mutexes based on 256 max processes and 0 max threads.
[Sun Apr 08 04:02:30 2012] [notice] Apache/2.2.3 (CentOS) configured -- resuming normal operations
[Sun Apr 08 04:02:30 2012] [notice] Graceful restart requested, doing restart
[Sun Apr 08 04:02:32 2012] [notice] Digest: generating secret for digest authentication ...
[Sun Apr 08 04:02:32 2012] [notice] Digest: done
[Sun Apr 08 04:02:32 2012] [notice] mod_python: Creating 4 session mutexes based on 256 max processes and 0 max threads.
[Sun Apr 08 04:02:32 2012] [notice] Apache/2.2.3 (CentOS) configured -- resuming normal operations
[Sun Apr 08 04:02:33 2012] [notice] Graceful restart requested, doing restart
[Sun Apr 08 04:02:34 2012] [notice] Digest: generating secret for digest authentication ...
[Sun Apr 08 04:02:34 2012] [notice] Digest: done
[Sun Apr 08 04:02:34 2012] [notice] mod_python: Creating 4 session mutexes based on 256 max processes and 0 max threads.
[Sun Apr 08 04:02:34 2012] [notice] Apache/2.2.3 (CentOS) configured -- resuming normal operations
----------------
[Mon Apr 09 21:40:08 2012] [warn] mod_fcgid: cleanup zombie process 18415
[Mon Apr 09 21:40:08 2012] [warn] mod_fcgid: cleanup zombie process 18432

Do you see anything usefull to resolve my issue?

Using command "netstat -anp --tcp --udp | grep LISTEN", I see httpd running
tcp 0 0 :::80 :::* LISTEN 15660/httpd

tcp 0 0 :::443 :::* LISTEN 15660/httpd

If I kill the process httpd start with another pid but I am still not able to restart the service.
This is the line on "top"
15660 apache 15 0 46832 18m 1844 S 0.0 0.9 0:01.15 httpd
but it doesn't change in about 5-10 minutes.

What do you think?

Thanks a lot !

pschaff
Retired Moderator
Posts: 18276
Joined: 2006/12/13 20:15:34
Location: Tidewater, Virginia, North America
Contact:

Re: apache error (98)Address already in use

Post by pschaff » 2012/04/10 17:22:00

[quote]
supportadl wrote:
..
What do you think?[/quote]
I haven't a clue and I'm not that familiar with virtual hosts. Perhaps if you show the configs someone could spot something, or at least know what other questions to ask.

Post Reply

Return to “CentOS 5 - Server Support”