Commit ac6758ac authored by Bruce Dawson's avatar Bruce Dawson Committed by Commit Bot

Revert "Check for LNK1201 and retry links when it occurs"

This reverts commit 798beff1.

Reason for revert: The original bug has been made irrelevant by the
switch to lld, so this workaround is no longer needed. Additionally,
crbug.com/817797 reports a failure sort of *caused* by this
workaround.

Original change's description:
> Check for LNK1201 and retry links when it occurs
>
> LNK1201 seems to be happening increasingly frequently on our debug x64
> builds for no clear reason. Subsequent builds tend to succeed so this
> change updates our link wrapper to retry links when this error is hit.
>
> This retry logic may solve the problem. If not then it gives us more
> evidence about the problem, including a backup copy of the PDB that
> might be helpful in investigating.
>
> Bug: 782660
> Change-Id: Iad60648425a01e07a20d108fcc5b74acaead9ee8
> Reviewed-on: https://chromium-review.googlesource.com/769333
> Commit-Queue: Bruce Dawson <brucedawson@chromium.org>
> Reviewed-by: Dirk Pranke <dpranke@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#516769}

R=dpranke@chromium.org,brucedawson@chromium.org

Bug: 782660,817797
Change-Id: Ifd03fecabdb462328898c7ef5253406cab2c570c
Reviewed-on: https://chromium-review.googlesource.com/1103377
Commit-Queue: Bruce Dawson <brucedawson@chromium.org>
Reviewed-by: default avatarDirk Pranke <dpranke@chromium.org>
Reviewed-by: default avatarBruce Dawson <brucedawson@chromium.org>
Cr-Commit-Position: refs/heads/master@{#568070}
parent bdd4715c
......@@ -33,13 +33,6 @@ BASE_DIR = os.path.dirname(os.path.abspath(__file__))
# A regex matching an argument corresponding to the output filename passed to
# link.exe.
_LINK_EXE_OUT_ARG = re.compile('/OUT:(?P<out>.+)$', re.IGNORECASE)
_LINK_PDB_OUT_ARG = re.compile('/PDB:(?P<out>.+)$', re.IGNORECASE)
_LINK_ERROR = re.compile('.* error LNK(\d+):')
# Retry links when this error is hit, to try to deal with crbug.com/782660
_LINKER_RETRY_ERRORS = 1201
# Maximum number of linker retries.
_LINKER_RETRIES = 3
def main(args):
exit_code = WinTool().Dispatch(args)
......@@ -148,37 +141,21 @@ class WinTool(object):
# Popen(['/bin/sh', '-c', args[0], args[1], ...])"
# For that reason, since going through the shell doesn't seem necessary on
# non-Windows don't do that there.
pdb_name = None
pe_name = None
for arg in args:
m = _LINK_PDB_OUT_ARG.match(arg)
if m:
pdb_name = m.group('out')
m = _LINK_EXE_OUT_ARG.match(arg)
if m:
pe_name = m.group('out')
for retry_count in range(_LINKER_RETRIES):
retry = False
link = subprocess.Popen(args, shell=sys.platform == 'win32', env=env,
stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
# Read output one line at a time as it shows up to avoid OOM failures when
# GBs of output is produced.
for line in link.stdout:
if (not line.startswith(' Creating library ') and
not line.startswith('Generating code') and
not line.startswith('Finished generating code')):
m = _LINK_ERROR.match(line)
if m:
error_code = int(m.groups()[0])
if error_code == _LINKER_RETRY_ERRORS:
print 'Retrying link due to error %d' % error_code
if pdb_name:
shutil.copyfile(pdb_name, pdb_name + 'failure_backup')
retry = True
print line,
result = link.wait()
if not retry:
break
link = subprocess.Popen(args, shell=sys.platform == 'win32', env=env,
stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
# Read output one line at a time as it shows up to avoid OOM failures when
# GBs of output is produced.
for line in link.stdout:
if (not line.startswith(' Creating library ') and
not line.startswith('Generating code') and
not line.startswith('Finished generating code')):
print line,
result = link.wait()
if result == 0 and sys.platform == 'win32':
# Flush the file buffers to try to work around a Windows 10 kernel bug,
# https://crbug.com/644525
......
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