couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Paul Joseph Davis (JIRA)" <>
Subject [jira] [Commented] (COUCHDB-1100) Server doesn't release HTTP connection when client queries a currently updating view and times out
Date Tue, 12 Jul 2011 19:35:59 GMT


Paul Joseph Davis commented on COUCHDB-1100:

Sounds like mochiweb/gen_tcp/something isn't raising any sort of message when the socket closes.
Though I can't say that I could really expect it unless it was doing some sort of active monitoring
on the file descriptor, which seems unlikely given that I'm pretty sure mochiweb uses the
whole active_once flag (IIRC).

Not entirely certain what the best solution to this would be other than maybe a maximum request
time? But that sounds an awful lot like just hitting it with a hammer.

> Server doesn't release HTTP connection when client queries a currently updating view
and times out
> --------------------------------------------------------------------------------------------------
>                 Key: COUCHDB-1100
>                 URL:
>             Project: CouchDB
>          Issue Type: Bug
>    Affects Versions: 1.0.2
>            Reporter: Pasi Eronen
> If a client queries a view that is currently updating (without stale=ok), and then closes
the connection after a timeout, the resources on the server side are not released (until the
view update completes).
> If the view update takes a long time, the server will eventually run out of file descriptors
(or if the file descriptor limit is very large, runs out of something else; not quite sure
> Steps to reproduce the problem:
> 1) set "ulimit -n" for couchdb to 1024 (often the default). Using a much larger limit
seems to result in different behavior (possibly CouchDB runs out of some other resource before
file descriptors; not sure what).
> 2) create a database with a view and sufficient number of docs so that generating the
view from scratch takes a lot of time
> 3) query the view repeatedly with a short timeout: for example in bash:
> while true; do curl -m1 '';
> 4) monitor the number of sockets used with e.g. "netstat -an | grep 5984 | grep CLOSE_WAIT".
This should increase all the time.
> 5) roughly when the number hits 1K, couchdb stops responding completely, and there's
large number of error messages written to the log file.

This message is automatically generated by JIRA.
For more information on JIRA, see:


View raw message