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

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: https://issues.apache.org/jira/browse/COUCHDB-1100
>             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 what).
> 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 
> 'http://127.0.0.1:5984/grande/_design/testviews/_view/byDate1?limit=1'; done
> 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: http://www.atlassian.com/software/jira

        

Reply via email to