From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ian Jackson Subject: [OSSTEST PATCH 4/4] Database locking: Tcl: Limit number of retries Date: Tue, 15 Dec 2015 16:26:26 +0000 Message-ID: <1450196786-27361-4-git-send-email-ian.jackson@eu.citrix.com> References: <1450196786-27361-1-git-send-email-ian.jackson@eu.citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1a8sRW-0001eL-4k for xen-devel@lists.xenproject.org; Tue, 15 Dec 2015 16:27:14 +0000 In-Reply-To: <1450196786-27361-1-git-send-email-ian.jackson@eu.citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xenproject.org Cc: Ian Jackson , Ian Campbell List-Id: xen-devel@lists.xenproject.org If there is something fundamentally wrong, don't just sit looping around every 500ms. Signed-off-by: Ian Jackson --- tcl/JobDB-Executive.tcl | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tcl/JobDB-Executive.tcl b/tcl/JobDB-Executive.tcl index 8e45ea7..7dba497 100644 --- a/tcl/JobDB-Executive.tcl +++ b/tcl/JobDB-Executive.tcl @@ -224,6 +224,8 @@ proc step-set-status {flight job stepno st} { } proc transaction {tables script} { + global errorInfo errorCode + set retries 100 db-open while 1 { set ol {} @@ -239,6 +241,10 @@ proc transaction {tables script} { } emsg]} { puts "commit failed: $emsg; retrying ..." db-execute ROLLBACK + if {[incr retries -1] <= 0} { + error \ + "commit failed, too many retries: $emsg\n$errorInfo\n$errorCode\n" + } after 500 continue } -- 1.7.10.4