[lxc-devel] [lxd/master] Enable SQLITE_CONFIG_MULTITHREAD

freeekanayaka on Github lxc-bot at linuxcontainers.org
Fri Dec 6 08:55:18 UTC 2019


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 516 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20191206/0a9ccb1a/attachment.bin>
-------------- next part --------------
From a1f8e184d76278f67939f0d076aabd840669649d Mon Sep 17 00:00:00 2001
From: Free Ekanayaka <free.ekanayaka at canonical.com>
Date: Fri, 6 Dec 2019 08:51:28 +0000
Subject: [PATCH] Enable SQLITE_CONFIG_MULTITHREAD

This is a temptative fix for the:

lxd: sqlite3.c:66776: removeFromSharingList: Assertion `0' failed.

failure that we occasionally see in jenkins.

Signed-off-by: Free Ekanayaka <free.ekanayaka at canonical.com>
---
 lxd/main.go | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/lxd/main.go b/lxd/main.go
index cf6b292cbb..1c6299e727 100644
--- a/lxd/main.go
+++ b/lxd/main.go
@@ -5,6 +5,7 @@ import (
 	"os"
 	"time"
 
+	"github.com/canonical/go-dqlite"
 	"github.com/spf13/cobra"
 
 	"github.com/lxc/lxd/lxd/daemon"
@@ -35,6 +36,16 @@ type cmdGlobal struct {
 }
 
 func (c *cmdGlobal) Run(cmd *cobra.Command, args []string) error {
+	// Configure dqlite to *not* disable internal SQLite locking, since we
+	// use SQLite both through dqlite and through go-dqlite, potentially
+	// from different threads at the same time. We need to call this
+	// function as early as possible since this is a global setting in
+	// SQLite, which can't be changed afterwise.
+	err := dqlite.ConfigMultiThread()
+	if err != nil {
+		return err
+	}
+
 	// Set logging global variables
 	daemon.Debug = c.flagLogDebug
 	daemon.Verbose = c.flagLogVerbose


More information about the lxc-devel mailing list