Subject: Re: Target runs multiple times in single session

From: Sergey Matveev <[email-masked]>
Date: Sat, 23 Sep 2023 22:16:55 +0300

Greetings!

*** spacefrogg [2023-09-21 19:12]:
>2. Sometimes, again for projects with many independent targets that can run
>in parallel, redo *at least* prints out that it ran one of those targets
>twice that all the targets depended upon (e.g. the compile script).

I investigated that issues and was able to reproduce it with 1k of
targets depending on a single common one. That was a race in goredo's
behaviour, that I certainly was aware about and desired to take into
account, but for some reason I do not see that in the code, that is
awful and serious issues indeed. It actually could run target multiple
times.

There is possibility of too runScript()s run at the same time, because
the target is out of date. They take the lock of the given target. Only
one succeeds, other fails, knowing that somebody get the lock earlier
and that means that target is being built. In that case, runScript()
awaits till the lock is release and exits, without trying to rerun the
target again. But runScript() can be started at the time, when other
runScript() already release its lock. So it won't know that the target
was just rebuilt. Now I check its dependency and if it contains current
BuildUUID, then it means that it was already built in current "session"
and do not need running.

Fixed in 1.31.0 release. Thanks for raising the issues about it! I
seldom saw "doubled" targets output, but did not think that it was
really run twice (or more), because all builds were fine and successful.

-- 
Sergey Matveev (http://www.stargrave.org/)
OpenPGP: 12AD 3268 9C66 0D42 6967  FD75 CB82 0563 2107 AD8A