git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] t1404: increase core.packedRefsTimeout to avoid occasional test failure
@ 2018-07-31 23:32 SZEDER Gábor
  2018-07-31 23:39 ` Jonathan Nieder
  0 siblings, 1 reply; 3+ messages in thread
From: SZEDER Gábor @ 2018-07-31 23:32 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Michael Haggerty, git, SZEDER Gábor

The test 'no bogus intermediate values during delete' in
't1404-update-ref-errors.sh', added in 6a2a7736d8 (t1404: demonstrate
two problems with reference transactions, 2017-09-08), tries to catch
undesirable side effects of deleting a ref, both loose and packed, in
a transaction.  To do so it is holding the packed refs file locked
when it starts 'git update-ref -d' in the background with a 3secs
'core.packedRefsTimeout' value.  After performing a few checks it is
then supposed to unlock the packed refs file before the background
'git update-ref's attempt to acquire the lock times out.

While 3secs timeout seems plenty, and indeed is sufficient in most
cases, on rare occasions it's just not quite enough: I saw this test
fail in Travis CI build jobs two, maybe three times because 'git
update-ref' timed out.

Increase that timeout by an order of magnitude to 30s to make such an
occasional failure even more improbable.  This won't make the test run
any longer under normal circumstances, because 'git update-ref' will
acquire the lock and resume execution as soon as it can.  And if it
turns out that even this increased timeout is still not enough, then
there are most likely bigger problems, e.g. the Travis CI build job
will exceed its time limit anyway, or the lockfile module is broken.

Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
---
 t/t1404-update-ref-errors.sh | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/t/t1404-update-ref-errors.sh b/t/t1404-update-ref-errors.sh
index 3a887b5113..372f0b1fbb 100755
--- a/t/t1404-update-ref-errors.sh
+++ b/t/t1404-update-ref-errors.sh
@@ -559,9 +559,9 @@ test_expect_success 'no bogus intermediate values during delete' '
 	{
 		# Note: the following command is intentionally run in the
 		# background. We increase the timeout so that `update-ref`
-		# attempts to acquire the `packed-refs` lock for longer than
-		# it takes for us to do the check then delete it:
-		git -c core.packedrefstimeout=3000 update-ref -d $prefix/foo &
+		# attempts to acquire the `packed-refs` lock for much longer
+		# than it takes for us to do the check then delete it:
+		git -c core.packedrefstimeout=30000 update-ref -d $prefix/foo &
 	} &&
 	pid2=$! &&
 	# Give update-ref plenty of time to get to the point where it tries
-- 
2.18.0.408.g42635c01bc


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] t1404: increase core.packedRefsTimeout to avoid occasional test failure
  2018-07-31 23:32 [PATCH] t1404: increase core.packedRefsTimeout to avoid occasional test failure SZEDER Gábor
@ 2018-07-31 23:39 ` Jonathan Nieder
  2018-08-01  1:37   ` SZEDER Gábor
  0 siblings, 1 reply; 3+ messages in thread
From: Jonathan Nieder @ 2018-07-31 23:39 UTC (permalink / raw)
  To: SZEDER Gábor; +Cc: Junio C Hamano, Michael Haggerty, git

Hi,

SZEDER Gábor wrote:

> While 3secs timeout seems plenty, and indeed is sufficient in most
> cases, on rare occasions it's just not quite enough: I saw this test
> fail in Travis CI build jobs two, maybe three times because 'git
> update-ref' timed out.

I suspect these tests will fail with valgrind (just because valgrind
makes things super slow).  Would it be safe to use timeout=-1?

Thanks,
Jonathan

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] t1404: increase core.packedRefsTimeout to avoid occasional test failure
  2018-07-31 23:39 ` Jonathan Nieder
@ 2018-08-01  1:37   ` SZEDER Gábor
  0 siblings, 0 replies; 3+ messages in thread
From: SZEDER Gábor @ 2018-08-01  1:37 UTC (permalink / raw)
  To: Jonathan Nieder; +Cc: Junio C Hamano, Michael Haggerty, Git mailing list

On Wed, Aug 1, 2018 at 1:39 AM Jonathan Nieder <jrnieder@gmail.com> wrote:
> SZEDER Gábor wrote:
>
> > While 3secs timeout seems plenty, and indeed is sufficient in most
> > cases, on rare occasions it's just not quite enough: I saw this test
> > fail in Travis CI build jobs two, maybe three times because 'git
> > update-ref' timed out.
>
> I suspect these tests will fail with valgrind (just because valgrind
> makes things super slow).  Would it be safe to use timeout=-1?

I don't know.
Travis CI has a time limit of about 45mins for the whole build job
(including installing dependencies and compilation), and any sensible
automated build system must have a similar time limit, so it would be
fine to wait indefinitely in such an environment, though in case of a
timeout we'd lose failure reports of failed tests, if there are any.

OTOH, my (and I guess most devs') test runs don't have such a time
limit, so I'm reluctant to change it to wait indefinitely.  But then
again, waiting indefinitely for a lock file is not all that different
from messing up something and creating an endless loop or a
deadlock...

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-08-01  1:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-31 23:32 [PATCH] t1404: increase core.packedRefsTimeout to avoid occasional test failure SZEDER Gábor
2018-07-31 23:39 ` Jonathan Nieder
2018-08-01  1:37   ` SZEDER Gábor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).