Fix a deadlock with redo-oob.
If a checksummed target A used to exist but is now missing, and we tried to redo-ifchange that exact file, we would unnecessarily run 'redo-oob A A'; that is, we have to build A in order to determine if A needs to be built. The sub-targets of redo-oob aren't run with REDO_UNLOCKED, so this would deadlock instantly. Add an assertion to redo-oob to ensure we never try to redo-ifchange the primary target (thus converting the deadlock into an exception). And skip doing redo-oob when the target is already the same as the thing we have to check.
This commit is contained in:
parent
91630a892a
commit
1d26d99e0c
4 changed files with 12 additions and 1 deletions
|
|
@ -95,7 +95,8 @@ def should_build(t):
|
|||
f = state.File(name=t)
|
||||
if f.is_failed():
|
||||
raise builder.ImmediateReturn(32)
|
||||
return dirty_deps(f, depth = '', max_changed = vars.RUNID)
|
||||
dirty = dirty_deps(f, depth = '', max_changed = vars.RUNID)
|
||||
return dirty==[f] and DIRTY or dirty
|
||||
|
||||
|
||||
rv = 202
|
||||
|
|
|
|||
|
|
@ -10,6 +10,9 @@ if len(sys.argv[1:]) < 2:
|
|||
target = sys.argv[1]
|
||||
deps = sys.argv[2:]
|
||||
|
||||
for d in deps:
|
||||
assert(d != target)
|
||||
|
||||
me = state.File(name=target)
|
||||
|
||||
os.environ['REDO_NO_OOB'] = '1'
|
||||
|
|
|
|||
1
state.py
1
state.py
|
|
@ -262,6 +262,7 @@ class File(object):
|
|||
reldep = relpath(dep, vars.BASE)
|
||||
debug2('add-dep: %r < %s %r\n' % (self.name, mode, reldep))
|
||||
assert(src.name == reldep)
|
||||
assert(self.id != src.id)
|
||||
_write("insert or replace into Deps "
|
||||
" (target, mode, source) values (?,?,?)",
|
||||
[self.id, mode, src.id])
|
||||
|
|
|
|||
|
|
@ -56,3 +56,9 @@ redo-ifchange usestamp usestamp2
|
|||
[ "$(wc -l <stampy.log)" -eq 5 ] || exit 71
|
||||
[ "$(wc -l <usestamp.log)" -eq 2 ] || exit 72
|
||||
[ "$(wc -l <usestamp2.log)" -eq 1 ] || exit 73
|
||||
|
||||
# this simple test used to cause a deadlock.
|
||||
../flush-cache.sh
|
||||
rm -f stampy
|
||||
redo-ifchange stampy
|
||||
[ "$(wc -l <stampy.log)" -eq 6 ] || exit 74
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue