couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Noah Slater (JIRA)" <j...@apache.org>
Subject [jira] Commented: (COUCHDB-393) Cannot discover currently running http port if ini file specifies port 0
Date Sun, 12 Jul 2009 23:07:14 GMT

    [ https://issues.apache.org/jira/browse/COUCHDB-393?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12730161#action_12730161
] 

Noah Slater commented on COUCHDB-393:
-------------------------------------

I'm slightly drunk, so may not be explaining things properly. Imagining the implementation
behind `-p` and `-n` as a black-box, I think you should simply expose this functionality via
the regular `couchdb` script, instead of having a new command. The current `couchdb` command
has a `-s` option, which is analogous as far as the user is concerned. So, to reiterate, keep
the implementation the same, but toss out the new shell script, and wrap up the functionality
into the existing `couchdb` command. And thanks, for dealing with my comments so patiently.
Heh.

> Cannot discover currently running http port if ini file specifies port 0
> ------------------------------------------------------------------------
>
>                 Key: COUCHDB-393
>                 URL: https://issues.apache.org/jira/browse/COUCHDB-393
>             Project: CouchDB
>          Issue Type: Improvement
>          Components: HTTP Interface
>    Affects Versions: 0.9
>         Environment: Ubuntu 9.04
>            Reporter: Stuart Langridge
>            Assignee: Noah Slater
>         Attachments: couchctl.patch
>
>
> It is currently not possible, if the ini file specifies port 0 as the http port (so that
the OS chooses a random port) to discover which port the OS actually chose.
> It would be nice if the currently running port was made available in the statusline output
(couchdb -s), but a log statement would be adequate; some way that an external script can
discover which port a running CouchDB is listening on.
> Edited discussion from #couchdb:
> <bitdiddle> aquarius: well at a glance it appears couch_http passes the 0 to mochiweb_http
which passes it to the mochiweb_socket_server, which passes it to gen_tcp, an erlang module
that lets the underlying OS assign it. mochiweb_socket_server then grabs that port and stores
it. It has a get method to retrieve properties but that needs to be exposed to mochiweb_http
so it would take a little work to do it. It's probably a JIRA ticket, unless someone else
sees a quicker approach
> <davisp> bitdiddle: you got that far and didn't find it?
> <aquarius> davisp: is there a better way to find the port?
> <davisp> oh, is that not the bind port?
>  I was just thinking a log statement
> <aquarius> davisp: the problem is if you specify 0 as the bind port (so the OS
chooses a port), how do you find out what was chosen?
> <davisp> aquarius: you have to look at the port returned by the socket
>  aquarius: in other words, CouchDB was never written to do that
> <davisp> AFAIK
> <bitdiddle> davisp: I found it, just needs some work to expose it
> <davisp> aquarius: and by do that, I mean, we never put in a statement to log that
> <bitdiddle> mochiweb_http is the module that needs to bubble it up
> <aquarius> davisp: I don't really mind whether it's a log statement or it's exposed
to couchdb -s (the latter seems tidier to me, but whichever), I just want to be able to start
couch on port 0 and then later find out which port got chosen :)
> <davisp> aquarius: for the time being you can use something like netstat or lsof,
but we'll get a log statement in there or something

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message