[ https://issues.apache.org/jira/browse/COUCHDB-1100?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13066790#comment-13066790 ] Pasi Eronen commented on COUCHDB-1100: -------------------------------------- The client usually has some maximum time it's willing to wait for the response (=finite socket timeout in HTTP code, if nothing else). Perhaps the client could tell the server this value (with e.g. a request parameter or a custom HTTP header)? > 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