Bug 42737 - (98)Address already in use: make_sock: could not bind to address 0.0.0.0:80 caused by multiple Listen directives
Summary: (98)Address already in use: make_sock: could not bind to address 0.0.0.0:80 c...
Status: RESOLVED INVALID
Alias: None
Product: Apache httpd-2
Classification: Unclassified
Component: All (show other bugs)
Version: 2.5-HEAD
Hardware: Other other
: P2 normal (vote)
Target Milestone: ---
Assignee: Apache HTTPD Bugs Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-06-25 16:04 UTC by mauricev
Modified: 2007-08-03 08:16 UTC (History)
1 user (show)



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description mauricev 2007-06-25 16:04:35 UTC
Apache cannot handle multiple Listen directives on the same port gracefully.

Intentionally create a misconfiguration with multiple Listen directives for the
same port, port 80.

At startup, apache complains with 
(98)Address already in use: make_sock: could not bind to address 0.0.0.0:80

and fails to launch.

What has happened is that Apache bound to temporarily to the port specified by
the first Listen directive then tried to bind to it again as it read the second
Listen directive and failed.

Ask yourself how much time and effort it would take to track this
misconfiguration down based on this erroneous error message.

Ideally, Apache should detect the second and subsequent Listen directives on the
same port for the same virtual host and report something like "Listen directive
conflict: Check Your Configuration".

This would save a lot of sleuthing should such a misconfiguration occur.
Comment 1 Davi Arnaut 2007-06-25 17:03:05 UTC
We could issue a warning when bind addresses are equal, this would catch listen directives
such as "localhost:80", "127.0.0.1:80". The warning would be something like: "Multiple Listen
directivespoint to the same address".
Comment 2 Jim Jagielski 2007-08-03 07:57:14 UTC
This isn't a bug but rather an enhancement request. Please reopen when you have a patch that adds this 
feature.
Comment 3 mauricev 2007-08-03 08:16:32 UTC
You're telling us that you intended for apache to fail to launch altogether just
because the config contains an extra Listen directive?

And you're also telling us that all enhancement requests must be fulfilled a
priori, that they can't be filed otherwise or only filed as invalid bugs?