couch_file gen_server will eventually be shutdown through the
reference counter pointed to by the the #db{} record.Key places to look at: http://github.com/fdmanana/couchdb/blob/trunk/src/couchdb/couch_db_updater.erl#L404 and http://github.com/fdmanana/couchdb/blob/trunk/src/couchdb/couch_ref_counter.erl#L96 and http://github.com/fdmanana/couchdb/blob/trunk/src/couchdb/couch_ref_counter.erl#L53 And yes, terminate is always called, except for exceptional cases like the one Paul mentioned. On Sat, Sep 25, 2010 at 4:47 PM, Robert Dionne <[email protected]> wrote: > > > > On Sep 25, 2010, at 11:15 AM, Randall Leeds wrote: > >> On Sat, Sep 25, 2010 at 17:07, Robert Dionne >> <[email protected]> wrote: >>> couch_file has a close function which presumably does the right thing, but >>> it's only called from couch_db_update:terminate >>> >> >> It just shuts down the process. > > right, I'm just wondering how couch_db_update:terminate is ever called? Does > it receive an EXIT message? > > >> The question on the table is whether >> that will close the raw file opened by the process as well. Stephen, >> can you reproduce the issue with .couch files if you set max_open_dbs >> really low (like 2) and repeatedly access three or four databases? If >> not, then I suspect it's a ref counting issue with the view index and >> not directly related to couch_file at all. >> >> -Randall > > -- Filipe David Manana, [email protected], [email protected] "Reasonable men adapt themselves to the world. Unreasonable men adapt the world to themselves. That's why all progress depends on unreasonable men."
