Patchwork [STABLE] transaction: fix file descriptor leak for journal.backupfiles

login
register
mail settings
Submitter Durham Goode
Date April 30, 2014, 10:41 p.m.
Message ID <b57531f5e247c777c58a.1398897698@dev2000.prn2.facebook.com>
Download mbox | patch
Permalink /patch/4458/
State Accepted
Commit c77418938d051c1aa9376de6dde338cb1f3ba400
Headers show

Comments

Durham Goode - April 30, 2014, 10:41 p.m.
# HG changeset patch
# User Durham Goode <durham@fb.com>
# Date 1398897398 25200
#      Wed Apr 30 15:36:38 2014 -0700
# Branch stable
# Node ID b57531f5e247c777c58a6864c28050ce212dcf3a
# Parent  e2031c8ca4f8939a21fea454cb64b7a2744d9c8d
transaction: fix file descriptor leak for journal.backupfiles

The journal.backupfiles descriptor wasn't being closed. This resulted in
hgsubversion test runs having a bagillion descriptors open, which crashed on
platforms with low open file limits (like OSX).
Matt Mackall - May 1, 2014, 1:31 p.m.
On Wed, 2014-04-30 at 15:41 -0700, Durham Goode wrote:
> # HG changeset patch
> # User Durham Goode <durham@fb.com>
> # Date 1398897398 25200
> #      Wed Apr 30 15:36:38 2014 -0700
> # Branch stable
> # Node ID b57531f5e247c777c58a6864c28050ce212dcf3a
> # Parent  e2031c8ca4f8939a21fea454cb64b7a2744d9c8d
> transaction: fix file descriptor leak for journal.backupfiles

Queued for stable, thanks.

Patch

diff --git a/mercurial/transaction.py b/mercurial/transaction.py
--- a/mercurial/transaction.py
+++ b/mercurial/transaction.py
@@ -220,6 +220,7 @@ 
         if self.count != 0:
             return
         self.file.close()
+        self.backupsfile.close()
         self.entries = []
         if self.after:
             self.after()
@@ -243,6 +244,7 @@ 
         self.count = 0
         self.usages = 0
         self.file.close()
+        self.backupsfile.close()
 
         if self.onabort is not None:
             self.onabort()