From nobody Tue Nov 4 11:29:32 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=xenproject.org ARC-Seal: i=1; a=rsa-sha256; t=1602095352; cv=none; d=zohomail.com; s=zohoarc; b=mbHKHdn/JKSdE3yxYDEyvvKb3Tiu0bHk23qBolJ+vQfbTU0ahyW/zE++BuTYUm3a7F9uAbkY0b98CHiKYimN4WgpZg8GB5qz3Spw9pMOr+BHdfYT3o3w/FO9tq4yI7WuPppNkXi46lhqqkuLEwNxUWJhLTEqPNkwmwqqgrjUjbw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1602095352; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Q7i2Z36N1c5TIVd7HCR0oNwh8BMEs9zraEou8S4wgZc=; b=WpDibTqA5ipIH37bN8c8PB7yVQ5rDJdXBykrbuTkMCYaT3Ujzr3Q7hnQMDpiBMd+Jrm0VmwVt0nd8Op7ReKFHvSWZtYT75kVoojPjFYAzCwv7868d96PKQcuZ1i6qfG21H+hBVjUjC1uUzBf1VAbuQrXVrAcInHJwCdp7iaPNBs= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 160209535208060.00575031021367; Wed, 7 Oct 2020 11:29:12 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.3769.11311 (Exim 4.92) (envelope-from ) id 1kQEBL-0006eZ-2D; Wed, 07 Oct 2020 18:28:55 +0000 Received: by outflank-mailman (output) from mailman id 3769.11311; Wed, 07 Oct 2020 18:28:54 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kQEBK-0006eK-RM; Wed, 07 Oct 2020 18:28:54 +0000 Received: by outflank-mailman (input) for mailman id 3769; Wed, 07 Oct 2020 18:28:53 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kQE48-00072Q-Ki for xen-devel@lists.xenproject.org; Wed, 07 Oct 2020 18:21:28 +0000 Received: from chiark.greenend.org.uk (unknown [2001:ba8:1e3::]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id eb24c2a7-e8e3-4be2-80b3-d5f4e8342ecc; Wed, 07 Oct 2020 18:20:08 +0000 (UTC) Received: from [172.18.45.5] (helo=zealot.relativity.greenend.org.uk) by chiark.greenend.org.uk (Debian Exim 4.84_2 #1) with esmtp (return-path ijackson@chiark.greenend.org.uk) id 1kQDjz-0007CF-2x; Wed, 07 Oct 2020 19:00:39 +0100 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kQE48-00072Q-Ki for xen-devel@lists.xenproject.org; Wed, 07 Oct 2020 18:21:28 +0000 Received: from chiark.greenend.org.uk (unknown [2001:ba8:1e3::]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id eb24c2a7-e8e3-4be2-80b3-d5f4e8342ecc; Wed, 07 Oct 2020 18:20:08 +0000 (UTC) Received: from [172.18.45.5] (helo=zealot.relativity.greenend.org.uk) by chiark.greenend.org.uk (Debian Exim 4.84_2 #1) with esmtp (return-path ijackson@chiark.greenend.org.uk) id 1kQDjz-0007CF-2x; Wed, 07 Oct 2020 19:00:39 +0100 X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: eb24c2a7-e8e3-4be2-80b3-d5f4e8342ecc From: Ian Jackson To: xen-devel@lists.xenproject.org Cc: Ian Jackson , Ian Jackson Subject: [OSSTEST PATCH 23/82] db_retry: Make the sleeps random and increasing Date: Wed, 7 Oct 2020 18:59:25 +0100 Message-Id: <20201007180024.7932-24-iwj@xenproject.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20201007180024.7932-1-iwj@xenproject.org> References: <20201007180024.7932-1-iwj@xenproject.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Ian Jackson When there's a thundering herd, this can run out of retries. Signed-off-by: Ian Jackson --- Osstest.pm | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Osstest.pm b/Osstest.pm index 734c0ef6..809194f0 100644 --- a/Osstest.pm +++ b/Osstest.pm @@ -311,7 +311,8 @@ sub db_retry ($$$;$$) { my ($pre,$body) =3D (ref $code eq 'ARRAY') ? @$code : (sub { }, $code); =20 - my $retries=3D 100; + my $max_retries=3D 100; + my $retry_count=3D 0; my $r; local $db_retry_stop; for (;;) { @@ -339,10 +340,12 @@ sub db_retry ($$$;$$) { }; last if !length $@; die $@ unless $mjobdb->need_retry($dbh, $committing); - die "$dbh $body $@ ?" unless $retries-- > 0; + die "$dbh $body $@ GIVING UP ?" if ++$retry_count >=3D $max_retrie= s; eval { $dbh->rollback(); }; - print STDERR "DB conflict (messages above may refer); retrying...\n"; - sleep(1); + my $delay =3D rand $retry_count; + print STDERR "DB conflict (messages above may refer);". + " retrying after $delay...\n"; + sleep($delay); } return $r; } --=20 2.20.1