couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Paul Joseph Davis (JIRA)" <>
Subject [jira] Updated: (COUCHDB-180) Too many view files may be held open, rendering CouchDB unusable
Date Sat, 20 Dec 2008 19:31:44 GMT


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:
>             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.

View raw message