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

Paul Joseph Davis commented on COUCHDB-1309:
--------------------------------------------

So reviewing this again, my last comment still stands. There's no reason to 
introduce the ddoc_changed function into the indexer API. These changes should 
be limited entirely to couch_index (minus the tests anyway). This is a simple 
fix. Just use Mod:get(signature, Mod:init(Db, DDoc)) (or similar) in the 
with_db call in couch_index:handle_cast/2 call for ddoc_updated.

The other thing that occurred to me over lunch is if we might want to 
reimplement this by just having couch_index close itself after a period of 
inactivity. At the moment there's no limit on the number of groups that are 
opened like we have for databases. Some sort of mechanism to close these things 
down after lack of use seems like a good idea. The patch to do this would be 
pretty trivial. All you have to do is add a Timeout to each reply/noreply 
response in the couch_index gen_server, and then have a handle_info(timeout) 
clause that returns {stop, normal, State}.

Other than that, I've heard other people wanting the update notifications for 
design docs so that could go in regardless. Another thing that we might want to 
think about is best practices for commits and whether commits should span 
applications. I don't have super strong feelings either way though I have heard 
the argument that not spanning applications decreases the chance that code 
starts getting super entangled.

Good work, Filipe
                
> File descriptor leaks on design document update and view cleanup
> ----------------------------------------------------------------
>
>                 Key: COUCHDB-1309
>                 URL: https://issues.apache.org/jira/browse/COUCHDB-1309
>             Project: CouchDB
>          Issue Type: Bug
>            Reporter: Filipe Manana
>            Assignee: Filipe Manana
>         Attachments: 12x-0001-Add-ddoc_updated-event.patch, 
> 12x-0002-Shutdown-view-group-on-ddoc-update.patch, couchdb-1309_12x.patch, 
> couchdb-1309_trunk.patch, master-0001-Add-ddoc_updated-event.patch, 
> master-0002-Shutdown-view-group-on-ddoc-update.patch
>
>
> If we add a design document with views defined in it, open the corresponding 
> view group (by querying one of its views for e.g.), then update the design 
> document in such a way that the view signature changes (changing a view's map 
> function code for e.g), the old view group remains open forever (unless a 
> server restart happens) and keeps it's view file reference counter active 
> forever.
> If a view cleanup request comes, the old view file is not deleted since the 
> reference counter is not dropped by the old view group, keeping the file 
> descriptor in use forever.
> This leakage is different from what is reported in COUCHDB-1129 but it's 
> somehow related.
> The attached patch, simply shutdowns a view group when the design document is 
> updated and the new view signature changes, releasing the old view file 
> descriptor (as soon as no more clients are using the old view).

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to