incubator-couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dave Cottlehuber (JIRA)" <>
Subject [jira] [Commented] (COUCHDB-1512) Provide proper error if a hostname (and not an ip) is used for bind_address
Date Wed, 11 Jul 2012 14:18:34 GMT


Dave Cottlehuber commented on COUCHDB-1512:

Here's a patch that should address it, error & stack trace now looks like this for [httpd]
bind_address =

BindAddress is invalid:
[error] [<0.97.0>] {error_report,<0.35.0>,

Andrew what platform was this on and how was CouchDB started? I don't get the hung VM that
you report, just a straight exit + stacktrace.

diff --git i/src/couchdb/couch_httpd.erl w/src/couchdb/couch_httpd.erl
index 7329c3b..a494178 100644
--- i/src/couchdb/couch_httpd.erl
+++ w/src/couchdb/couch_httpd.erl
@@ -97,6 +97,14 @@ start_link(Name, Options) ->
     % will restart us and then we will pick up the new settings.
     BindAddress = couch_config:get("httpd", "bind_address", any),
+    % ensure BindAddress is not symbolic hostname. Fixes COUCHDB-1512.
+    case inet_parse:address(BindAddress) of
+        {ok, _BindAddress} -> BindAddress;
+        _ ->
+            io:format("BindAddress is invalid: ~s~n", [BindAddress]),
+            throw({error, invalid_bind_address})
+    end,
     DefaultSpec = "{couch_httpd_db, handle_request}",
     DefaultFun = make_arity_1_fun(
         couch_config:get("httpd", "default_handler", DefaultSpec)

#1 I assume it's OK to use inet_parse:address even though it's not specifically documented,
but is referred to in

#2 It seems during start_link/2 we only return errors via io:format rather than ?LOG macros.
Is there a good reason for that?

> Provide proper error if a hostname (and not an ip) is used for bind_address
> ---------------------------------------------------------------------------
>                 Key: COUCHDB-1512
>                 URL:
>             Project: CouchDB
>          Issue Type: Improvement
>            Reporter: Andrew Melo
>            Assignee: Dave Cottlehuber
>            Priority: Minor
> Currently, couch throws an opaque error message and doesn't bind the tcp port, but the
process doesn't die, so it's unclear what's happening. Preferably, couch should raise an informative
error message and die if an invalid bind_address is passed

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:!default.jspa
For more information on JIRA, see:


View raw message