Return-Path: Delivered-To: apmail-couchdb-dev-archive@www.apache.org Received: (qmail 62470 invoked from network); 20 Dec 2008 19:32:07 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 20 Dec 2008 19:32:07 -0000 Received: (qmail 58513 invoked by uid 500); 20 Dec 2008 19:32:07 -0000 Delivered-To: apmail-couchdb-dev-archive@couchdb.apache.org Received: (qmail 58480 invoked by uid 500); 20 Dec 2008 19:32:07 -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 58469 invoked by uid 500); 20 Dec 2008 19:32:06 -0000 Delivered-To: apmail-incubator-couchdb-dev@incubator.apache.org Received: (qmail 58466 invoked by uid 99); 20 Dec 2008 19:32:06 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 20 Dec 2008 11:32:06 -0800 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 20 Dec 2008 19:32:05 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 44FC1234C2CB for ; Sat, 20 Dec 2008 11:31:44 -0800 (PST) Message-ID: <1132963178.1229801504281.JavaMail.jira@brutus> Date: Sat, 20 Dec 2008 11:31:44 -0800 (PST) From: "Paul Joseph Davis (JIRA)" To: couchdb-dev@incubator.apache.org Subject: [jira] Updated: (COUCHDB-180) Too many view files may be held open, rendering CouchDB unusable In-Reply-To: <1932341814.1229791184308.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/COUCHDB-180?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Paul Joseph Davis updated COUCHDB-180: -------------------------------------- Attachment: COUCHDB-180.patch In this particular case the error is stemming from the fact that the gen_server in couch_view_group.erl was not closing it's view file descriptor contained in the Group. Looking around I noticed that there are a couple places where we're not closing the file descriptor properly so I just put the call to close in terminate/2. I don't actually think this is the correct patch to apply because I'm pretty sure there are corner cases in temp views that could cause breakage. (Specifcally, one temp view hitting a reset condition and then causing the entire file to be closed even out from underneath other temp views.) The proper answer to this I think will be to make sure that all view files are opened in the ref_counted mode which also means that couch_view will require work to deref all it's temp view file handles etc. Damien mentioned at one point that the fd even for permanent views should be opened by couch_view. This could work but a few of the reset functions will need to be switched from an outright delete to a truncate so as to not confuse couch_view. Anyone have other ideas? > Too many view files may be held open, rendering CouchDB unusable > ---------------------------------------------------------------- > > Key: COUCHDB-180 > URL: https://issues.apache.org/jira/browse/COUCHDB-180 > Project: CouchDB > Issue Type: Bug > Components: JavaScript View Server > Affects Versions: 0.9 > Environment: OS X 10.5.5 > Reporter: Paul Carey > Attachments: COUCHDB-180.patch, test_for_open_files.js > > > On trunk (rev 728285), CouchDB will hold onto view files for a certain request pattern. > Once a threshold of open files has been exceeded, all requests to CouchDB will result in {error,emfile}. > The attached test case runs through the following sequence n times. > delete db > create db > create doc > query non existant view > create view > query view > On my machine a value of about 250 for n is enough for the threshold to be exceeded. Regardless, running lsof clearly shows CouchDB holding multiple refs to the same view file. > -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.