Return-Path: X-Original-To: apmail-couchdb-dev-archive@www.apache.org Delivered-To: apmail-couchdb-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id C6CE5D7F0 for ; Wed, 11 Jul 2012 14:18:38 +0000 (UTC) Received: (qmail 53927 invoked by uid 500); 11 Jul 2012 14:18:38 -0000 Delivered-To: apmail-couchdb-dev-archive@couchdb.apache.org Received: (qmail 53331 invoked by uid 500); 11 Jul 2012 14:18:37 -0000 Mailing-List: contact dev-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@couchdb.apache.org Delivered-To: mailing list dev@couchdb.apache.org Received: (qmail 51480 invoked by uid 99); 11 Jul 2012 14:18:35 -0000 Received: from issues-vm.apache.org (HELO issues-vm) (140.211.11.160) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 11 Jul 2012 14:18:35 +0000 Received: from isssues-vm.apache.org (localhost [127.0.0.1]) by issues-vm (Postfix) with ESMTP id CF662142860 for ; Wed, 11 Jul 2012 14:18:34 +0000 (UTC) Date: Wed, 11 Jul 2012 14:18:34 +0000 (UTC) From: "Dave Cottlehuber (JIRA)" To: dev@couchdb.apache.org Message-ID: <439087725.35509.1342016314854.JavaMail.jiratomcat@issues-vm> In-Reply-To: <322853146.32852.1341967834586.JavaMail.jiratomcat@issues-vm> Subject: [jira] [Commented] (COUCHDB-1512) Provide proper error if a hostname (and not an ip) is used for bind_address MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/COUCHDB-1512?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13411547#comment-13411547 ] 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 = foo.bar BindAddress is invalid: foo.bar [error] [<0.97.0>] {error_report,<0.35.0>, {<0.97.0>,supervisor_report, [{supervisor,{local,couch_secondary_services}}, {errorContext,start_error}, {reason,invalid_bind_address}, 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 www.erlang.org/doc/man/inet.html #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: https://issues.apache.org/jira/browse/COUCHDB-1512 > 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: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira