[PATCH] localrepo: prevent leak of transaction object (issue4258)
Augie Fackler
raf at durin42.com
Thu May 22 10:11:08 CDT 2014
On May 21, 2014, at 9:36 PM, Durham Goode <durham at fb.com> wrote:
> On 5/21/14, 6:02 PM, "Gregory Szorc" <gregory.szorc at gmail.com> wrote:
>
>> # HG changeset patch
>> # User Gregory Szorc <gregory.szorc at gmail.com>
>> # Date 1400720555 25200
>> # Wed May 21 18:02:35 2014 -0700
>> # Node ID 86829970c3fbf3134560a143f74444066d2e9623
>> # Parent 9fb6f328576ac4e38f4e5071c4d669a6ceb3a76e
>> localrepo: prevent leak of transaction object (issue4258)
>>
>> The onclose() closure added in cd443c7589cc held a regular reference to
>> the transaction object. This was causing the transaction to not gc and
>> a leak to occur.
>>
>> The closure now holds a reference to the weakref instance and the leak
>> goes away.
>>
>> diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
>> --- a/mercurial/localrepo.py
>> +++ b/mercurial/localrepo.py
>> @@ -860,9 +860,9 @@ class localrepository(object):
>> _("abandoned transaction found"),
>> hint=_("run 'hg recover' to clean up transaction"))
>>
>> def onclose():
>> - self.store.write(tr)
>> + self.store.write(self._transref())
>>
>> self._writejournal(desc)
>> renames = [(vfs, x, undoname(x)) for vfs, x in
>> self._journalfiles()]
>> rp = report and report or self.ui.warn
>
> I’m not familiar with the weak reference stuff in transactions, but if the
> tests pass, this looks good to me. Should probably be queued for STABLE
> though.
Agreed. I'm going to defer to mpm on this one because I'm not familiar enough with weakrefs.
>
> Thanks for fixing this.
>
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://selenic.com/pipermail/mercurial-devel/attachments/20140522/a335d7a9/attachment.pgp>
More information about the Mercurial-devel
mailing list