# HG changeset patch # User Marcin Kuzminski # Date 1354213773 -3600 # Node ID b61824e61e68461a30e73d1280c04b5a50fef43e # Parent 303878dc3dac66db18a4afff650f12e483afa6b9 Don't cache dulwich Repos, in pararell multithreaded evniroment dulwich pack file openers can break badly. We need to create Repo() objects always for each call, even when it's taken from cache. Fixed issue with dulwich filedescriptor leak ref #573 diff -r 303878dc3dac -r b61824e61e68 rhodecode/lib/vcs/backends/git/repository.py --- a/rhodecode/lib/vcs/backends/git/repository.py Thu Nov 29 19:24:44 2012 +0100 +++ b/rhodecode/lib/vcs/backends/git/repository.py Thu Nov 29 19:29:33 2012 +0100 @@ -54,7 +54,18 @@ update_after_clone=False, bare=False): self.path = abspath(repo_path) - self._repo = self._get_repo(create, src_url, update_after_clone, bare) + repo = self._get_repo(create, src_url, update_after_clone, bare) + self.bare = repo.bare + + self._config_files = [ + bare and abspath(self.path, 'config') or abspath(self.path, '.git', + 'config'), + abspath(get_user_home(), '.gitconfig'), + ] + + @property + def _repo(self): + repo = Repo(self.path) #temporary set that to now at later we will move it to constructor baseui = None if baseui is None: @@ -62,19 +73,15 @@ baseui = ui() # patch the instance of GitRepo with an "FAKE" ui object to add # compatibility layer with Mercurial - setattr(self._repo, 'ui', baseui) - - try: - self.head = self._repo.head() - except KeyError: - self.head = None + setattr(repo, 'ui', baseui) + return repo - self._config_files = [ - bare and abspath(self.path, 'config') or abspath(self.path, '.git', - 'config'), - abspath(get_user_home(), '.gitconfig'), - ] - self.bare = self._repo.bare + @property + def head(self): + try: + return self._repo.head() + except KeyError: + return None @LazyProperty def revisions(self):