Return-Path: Delivered-To: apmail-couchdb-commits-archive@www.apache.org Received: (qmail 61624 invoked from network); 25 Aug 2009 04:49:40 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 25 Aug 2009 04:49:40 -0000 Received: (qmail 59634 invoked by uid 500); 25 Aug 2009 04:50:05 -0000 Delivered-To: apmail-couchdb-commits-archive@couchdb.apache.org Received: (qmail 59528 invoked by uid 500); 25 Aug 2009 04:50:05 -0000 Mailing-List: contact commits-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 commits@couchdb.apache.org Received: (qmail 59518 invoked by uid 99); 25 Aug 2009 04:50:04 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 25 Aug 2009 04:50:04 +0000 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.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 25 Aug 2009 04:50:01 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 7998D23888E4; Tue, 25 Aug 2009 04:49:39 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r807477 - /couchdb/trunk/src/couchdb/couch_rep_changes_feed.erl Date: Tue, 25 Aug 2009 04:49:39 -0000 To: commits@couchdb.apache.org From: kocolosk@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20090825044939.7998D23888E4@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: kocolosk Date: Tue Aug 25 04:49:39 2009 New Revision: 807477 URL: http://svn.apache.org/viewvc?rev=807477&view=rev Log: fix a process leak in local changes feed consumer Modified: couchdb/trunk/src/couchdb/couch_rep_changes_feed.erl Modified: couchdb/trunk/src/couchdb/couch_rep_changes_feed.erl URL: http://svn.apache.org/viewvc/couchdb/trunk/src/couchdb/couch_rep_changes_feed.erl?rev=807477&r1=807476&r2=807477&view=diff ============================================================================== --- couchdb/trunk/src/couchdb/couch_rep_changes_feed.erl (original) +++ couchdb/trunk/src/couchdb/couch_rep_changes_feed.erl Tue Aug 25 04:49:39 2009 @@ -97,7 +97,12 @@ false -> spawn_link(fun() -> send_local_changes_once(Server, Source, Since) end); true -> - spawn_link(fun() -> send_local_changes_forever(Server, Source, Since) end) + spawn_link(fun() -> + Self = self(), + {ok, _} = couch_db_update_notifier:start_link(fun(Msg) -> + local_update_notification(Self, Source#db.name, Msg) end), + send_local_changes_forever(Server, Source, Since) + end) end, {ok, #state{changes_loop=ChangesPid}}. @@ -312,9 +317,6 @@ send_local_changes_forever(Server, Db, Since) -> #db{name = DbName, user_ctx = UserCtx} = Db, - Self = self(), - {ok, _} = couch_db_update_notifier:start_link( - fun(Msg) -> local_update_notification(Self, DbName, Msg) end), {ok, NewSeq} = send_local_changes_once(Server, Db, Since), couch_db:close(Db), ok = wait_db_updated(),