Patchwork [STABLE] fix: disable use of thread-based worker

login
register
mail settings
Submitter Yuya Nishihara
Date Oct. 31, 2018, 12:34 p.m.
Message ID <7dfbc7af72cb0c36717d.1540989249@mimosa>
Download mbox | patch
Permalink /patch/36290/
State Accepted
Headers show

Comments

Yuya Nishihara - Oct. 31, 2018, 12:34 p.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1540988214 -32400
#      Wed Oct 31 21:16:54 2018 +0900
# Branch stable
# Node ID 7dfbc7af72cb0c36717daee3313161a1edd79aa5
# Parent  bafa1c4bb7a8d397f62e0cd75b8064ef1375b753
fix: disable use of thread-based worker

getfixes() accesses to repo, changectx, filectx, etc., so I believe there
are code paths triggering data race. Mercurial API isn't thread safe in
general.
Augie Fackler - Oct. 31, 2018, 2:50 p.m.
queued, thanks

(worst case we revisit after the freeze if this is too conservative)

> On Oct 31, 2018, at 08:34, Yuya Nishihara <yuya@tcha.org> wrote:
> 
> # HG changeset patch
> # User Yuya Nishihara <yuya@tcha.org>
> # Date 1540988214 -32400
> #      Wed Oct 31 21:16:54 2018 +0900
> # Branch stable
> # Node ID 7dfbc7af72cb0c36717daee3313161a1edd79aa5
> # Parent  bafa1c4bb7a8d397f62e0cd75b8064ef1375b753
> fix: disable use of thread-based worker
> 
> getfixes() accesses to repo, changectx, filectx, etc., so I believe there
> are code paths triggering data race. Mercurial API isn't thread safe in
> general.
> 
> diff --git a/hgext/fix.py b/hgext/fix.py
> --- a/hgext/fix.py
> +++ b/hgext/fix.py
> @@ -157,7 +157,8 @@ def fix(ui, repo, *pats, **opts):
>                 # Don't waste memory/time passing unchanged content back, but
>                 # produce one result per item either way.
>                 yield (rev, path, newdata if newdata != olddata else None)
> -        results = worker.worker(ui, 1.0, getfixes, tuple(), workqueue)
> +        results = worker.worker(ui, 1.0, getfixes, tuple(), workqueue,
> +                                threadsafe=False)
> 
>         # We have to hold on to the data for each successor revision in memory
>         # until all its parents are committed. We ensure this by committing and
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Patch

diff --git a/hgext/fix.py b/hgext/fix.py
--- a/hgext/fix.py
+++ b/hgext/fix.py
@@ -157,7 +157,8 @@  def fix(ui, repo, *pats, **opts):
                 # Don't waste memory/time passing unchanged content back, but
                 # produce one result per item either way.
                 yield (rev, path, newdata if newdata != olddata else None)
-        results = worker.worker(ui, 1.0, getfixes, tuple(), workqueue)
+        results = worker.worker(ui, 1.0, getfixes, tuple(), workqueue,
+                                threadsafe=False)
 
         # We have to hold on to the data for each successor revision in memory
         # until all its parents are committed. We ensure this by committing and