Commit f52e3cf8 by Ben Patterson

Workaround for `cb() never called` errors

Problem:

Intermittent "cb() never called!" errors on npm installs for platform.
This is likely due to a race condition on installing OS-specific bits that are built during time of install. When more than one compilation takes place at one time, this error can occur.

Workaround:

Detect the error and re-run the install. (When retrying, one or all of the bits have been compiled. So running it again just finishes the install.)
parent 695e5c07
...@@ -8,7 +8,7 @@ import os ...@@ -8,7 +8,7 @@ import os
import re import re
import sys import sys
from paver.easy import sh, task from paver.easy import sh, task, BuildFailure
from .utils.envs import Env from .utils.envs import Env
from .utils.timer import timed from .utils.timer import timed
...@@ -132,10 +132,19 @@ def node_prereqs_installation(): ...@@ -132,10 +132,19 @@ def node_prereqs_installation():
""" """
Configures npm and installs Node prerequisites Configures npm and installs Node prerequisites
""" """
cb_error_text = "Subprocess return code: 1"
sh("test `npm config get registry` = \"{reg}\" || " sh("test `npm config get registry` = \"{reg}\" || "
"(echo setting registry; npm config set registry" "(echo setting registry; npm config set registry"
" {reg})".format(reg=NPM_REGISTRY)) " {reg})".format(reg=NPM_REGISTRY))
sh('npm install')
# Error handling around a race condition that produces "cb() never called" error. This
# ought to disappear when we upgrade npm to 3 or higher. TODO: clean this up when we do that.
try:
sh('npm install')
except BuildFailure, error_text:
if cb_error_text in error_text:
print "npm install error detected. Retrying..."
sh('npm install')
def python_prereqs_installation(): def python_prereqs_installation():
......
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