blog:apache_redhat_6_make_sock_bug

This is an old revision of the document!


Apache Redhat 6 make_sock Apache defect

This is a fucker of a defect that affected RedHat 6.3, 6.4, 6.5 - which I've verified. Probably 6.0, 6.1, 6.2 and 6.3 as well.

[Thu Sep 19 14:11:13 2013] [warn] VirtualHost localhost:82 overlaps with VirtualHost localhost:82, the first has precedence, perhaps you need a NameVirtualHost directive
[Thu Sep 19 14:11:13 2013] [warn] VirtualHost localhost:81 overlaps with VirtualHost localhost:81, the first has precedence, perhaps you need a NameVirtualHost directive
(98)Address already in use: make_sock: could not bind to address 127.0.0.1:81
no listening sockets available, shutting down
Unable to open logs

Doing an lsof on port 81 tells you nothing is listening.

Apache throws this in the STRACE saying it can't startup and the strace doesn't give you much clue.

32709 setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
32709 setsockopt(3, SOL_SOCKET, SO_KEEPALIVE, [1], 4) = 0
32709 setsockopt(3, SOL_TCP, TCP_NODELAY, [1], 4) = 0
32709 bind(3, {sa_family=AF_INET, sin_port=htons(81), sin_addr=inet_addr("127.0.0.1")}, 16) = 0
32709 listen(3, 511)                    = 0
32709 setsockopt(4, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
32709 setsockopt(4, SOL_SOCKET, SO_KEEPALIVE, [1], 4) = 0
32709 setsockopt(4, SOL_TCP, TCP_NODELAY, [1], 4) = 0
32709 bind(4, {sa_family=AF_INET, sin_port=htons(81), sin_addr=inet_addr("127.0.0.1")}, 16) = -1 EADDRINUSE (Address already in use)
32709 write(2, ""..., 78)               = 78
32709 close(4)                          = 0
32709 write(2, ""..., 46)               = 46
32709 write(2, ""..., 20)               = 20

The solution: simply stated the trouble makers were found in /etc/hosts as follows:

127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6

Once we had removed 'localhost' and 'localhost.localdomain' from the ::1 definition line, apache/httpd could start successfully.

  • blog/apache_redhat_6_make_sock_bug.1401420216.txt.gz
  • Last modified: 2014/05/30 03:23
  • by brett