diff --git a/gclient_scm.py b/gclient_scm.py index 242b2c45c..fd098e240 100644 --- a/gclient_scm.py +++ b/gclient_scm.py @@ -255,7 +255,7 @@ class GitWrapper(SCMWrapper): quiet = ['--quiet'] self._UpdateBranchHeads(options, fetch=False) - cfg = gclient_utils.DefaultIndexPackConfig() + cfg = gclient_utils.DefaultIndexPackConfig(self.url) fetch_cmd = cfg + ['fetch', self.remote, '--prune'] self._Run(fetch_cmd + quiet, options, retry=True) self._Run(['reset', '--hard', revision] + quiet, options) @@ -725,7 +725,7 @@ class GitWrapper(SCMWrapper): print('') template_path = os.path.join( os.path.dirname(THIS_FILE_PATH), 'git-templates') - cfg = gclient_utils.DefaultIndexPackConfig() + cfg = gclient_utils.DefaultIndexPackConfig(self.url) clone_cmd = cfg + [ 'clone', '--no-checkout', '--progress', '--template=%s' % template_path] if self.cache_dir: @@ -937,7 +937,7 @@ class GitWrapper(SCMWrapper): '^\\+refs/branch-heads/\\*:.*$'] self._Run(config_cmd, options) if fetch: - cfg = gclient_utils.DefaultIndexPackConfig() + cfg = gclient_utils.DefaultIndexPackConfig(self.url) fetch_cmd = cfg + ['fetch', self.remote] if options.verbose: fetch_cmd.append('--verbose') diff --git a/gclient_utils.py b/gclient_utils.py index 44dba57df..351794643 100644 --- a/gclient_utils.py +++ b/gclient_utils.py @@ -30,6 +30,14 @@ RETRY_INITIAL_SLEEP = 0.5 _WARNINGS = [] +# These repos are known to cause OOM errors on 32-bit platforms, due the the +# very large objects they contain. It is not safe to use threaded index-pack +# when cloning/fetching them. +THREADED_INDEX_PACK_BLACKLIST = [ + 'https://chromium.googlesource.com/chromium/reference_builds/chrome_win.git' +] + + class Error(Exception): """gclient exception class.""" def __init__(self, msg, *args, **kwargs): @@ -990,10 +998,13 @@ def DefaultDeltaBaseCacheLimit(): else: return '512m' -def DefaultIndexPackConfig(): +def DefaultIndexPackConfig(url=''): """Return reasonable default values for configuring git-index-pack. Experiments suggest that higher values for pack.threads don't improve performance.""" - return ['-c', 'pack.threads=5', '-c', - 'core.deltaBaseCacheLimit=%s' % DefaultDeltaBaseCacheLimit()] + cache_limit = DefaultDeltaBaseCacheLimit() + result = ['-c', 'core.deltaBaseCacheLimit=%s' % cache_limit] + if url in THREADED_INDEX_PACK_BLACKLIST: + result.extend(['-c', 'pack.threads=1']) + return result