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
Pipeline #6504 failed with stage
in 0 seconds
......@@ -41,20 +41,17 @@ from erp5.component.module.WorkingCopy import \
NotAWorkingCopyError, NotVersionedError, VcsConflictError
from erp5.component.module.SubversionClient import newSubversionClient
# XXX Still not thread safe !!! Proper fix is to never use 'os.chdir'
# Using a RLock is a temporary quick change that only protects against
# concurrent uses of ERP5 Subversion.
_chdir_lock = threading.RLock()
# XXX This does not work with concurrent processes/threads accessing the
# same working copy...
@simple_decorator
def chdir_working_copy(func):
def decorator(self, *args, **kw):
with _chdir_lock:
cwd = os.getcwd()
try:
os.chdir(self.working_copy)
return func(self, *args, **kw)
finally:
os.chdir(cwd)
cwd = os.getcwd()
try:
os.chdir(self.working_copy)
return func(self, *args, **kw)
finally:
os.chdir(cwd)
return decorator
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