summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Mach <dmach@redhat.com>2021-07-02 08:23:55 +0200
committerPanu Matilainen <pmatilai@redhat.com>2021-08-20 11:44:09 +0300
commit6f63bf93cfd4700e0561b57410a957d0356ca9aa (patch)
treee68f4f4f6e915e71b6951963385f3d2a8289a4ad
parent20629b072ba81d3042dcd78a3144f882204df2ff (diff)
downloadrpm-6f63bf93cfd4700e0561b57410a957d0356ca9aa.tar.gz
Set an extremely high sqlite3 timeout
We must avoid the "database is locked" errors at every cost because otherwise the rpmdb gets corrupted and system ends up in inconsistent state. Resolves: rhbz#1946046 (cherry picked from commit 513d04db9f0cb49e35829d521ffcf7455bfa8a7c)
-rw-r--r--lib/backend/sqlite.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/backend/sqlite.c b/lib/backend/sqlite.c
index dbefeb163..c22a27019 100644
--- a/lib/backend/sqlite.c
+++ b/lib/backend/sqlite.c
@@ -164,7 +164,11 @@ static int sqlite_init(rpmdb rdb, const char * dbhome)
(SQLITE_UTF8|SQLITE_DETERMINISTIC),
NULL, rpm_match3, NULL, NULL);
- sqlite3_busy_timeout(sdb, sleep_ms);
+ /*
+ * Set an extremely high timeout because we must avoid
+ * the "database is locked" errors at every cost
+ */
+ sqlite3_busy_timeout(sdb, 10000);
sqlite3_config(SQLITE_CONFIG_LOG, errCb, rdb);
sqlexec(sdb, "PRAGMA secure_delete = OFF");