Commit 58144924 authored by Arnaud Fontaine's avatar Arnaud Fontaine

ZODB Components: Remove broken Subversion threading.RLock().

* This didn't work anyway with concurrent processes using the same SVN working
  copy (which is a frequent use case nowadays).
* Now that it has been migrated to ZODB Components, this also breaks on reset:
  1) Thread T1 acquires the lock.
  2) Thread T2 performs a reset.
  3) Thread T2 loads Subversion and thus a new RLock instance is created.
  => T2 can acquire the lock.
parent 2cff7d32
...@@ -41,20 +41,17 @@ from erp5.component.module.WorkingCopy import \ ...@@ -41,20 +41,17 @@ from erp5.component.module.WorkingCopy import \
NotAWorkingCopyError, NotVersionedError, VcsConflictError NotAWorkingCopyError, NotVersionedError, VcsConflictError
from erp5.component.module.SubversionClient import newSubversionClient from erp5.component.module.SubversionClient import newSubversionClient
# XXX Still not thread safe !!! Proper fix is to never use 'os.chdir' # XXX This does not work with concurrent processes/threads accessing the
# Using a RLock is a temporary quick change that only protects against # same working copy...
# concurrent uses of ERP5 Subversion.
_chdir_lock = threading.RLock()
@simple_decorator @simple_decorator
def chdir_working_copy(func): def chdir_working_copy(func):
def decorator(self, *args, **kw): def decorator(self, *args, **kw):
with _chdir_lock: cwd = os.getcwd()
cwd = os.getcwd() try:
try: os.chdir(self.working_copy)
os.chdir(self.working_copy) return func(self, *args, **kw)
return func(self, *args, **kw) finally:
finally: os.chdir(cwd)
os.chdir(cwd)
return decorator return decorator
class Subversion(WorkingCopy): class Subversion(WorkingCopy):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment