Bug 269889 - databases/sqlite3: Disabling DQS Breaks Sonarr and Emby-Server
Summary: databases/sqlite3: Disabling DQS Breaks Sonarr and Emby-Server
Status: Closed Works As Intended
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: amd64 Any
: --- Affects Many People
Assignee: freebsd-ports-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-03-01 03:43 UTC by Matt
Modified: 2023-04-28 09:57 UTC (History)
5 users (show)

See Also:
bugzilla: maintainer-feedback? (pavelivolkov)


Attachments
Emby Log (15.61 KB, text/plain)
2023-03-01 03:43 UTC, Matt
no flags Details
Sonarr Log (6.02 KB, text/plain)
2023-03-01 03:44 UTC, Matt
no flags Details
tautulli log (5.89 KB, text/plain)
2023-03-06 15:56 UTC, Michiel van Baak Jansen
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Matt 2023-03-01 03:43:15 UTC
Not sure what the intended purpose of disabling DQS by default is, but it is already breaking emby-server and sonarr.

Sonarr reports database corruption and emby-server fails to execute some database operations.
Comment 1 Matt 2023-03-01 03:43:46 UTC
Created attachment 240493 [details]
Emby Log
Comment 2 Matt 2023-03-01 03:44:01 UTC
Created attachment 240494 [details]
Sonarr Log
Comment 3 Dries Michiels freebsd_committer freebsd_triage 2023-03-01 10:43:59 UTC
As emby-server maintainer, I'm taking this upstream how we will deal with it. Ideally the source code gets adapted.
Comment 4 Florian Smeets freebsd_committer freebsd_triage 2023-03-01 21:46:38 UTC
For now I didn't have much time to look at Sonarr and see if I can find where the SQL queries are and if we can fix them. I did however create an issue in the Sonarr Github https://github.com/Sonarr/Sonarr/issues/5464

I hope to find some time over the weekend to look at this some more.
Comment 5 Michiel van Baak Jansen 2023-03-02 09:00:09 UTC
Sonarr is not going to fix it in sonarr v3 (current stable) and in sonarr v4 (currently in beta) this is not a problem.

While I agree that disabling DQS is in line with upstream sqlite3, and probably the way to go, the easy way out here is to enable it again for the port, to help downstream ports.
Comment 6 Robert Clausecker freebsd_committer freebsd_triage 2023-03-02 19:35:41 UTC
Note that the DQS feature can be enabled on a per connection basis with code like this:

    sqlite3_db_config(db, SQLITE_DBCONFIG_DQS_DDL, 0, (void*)0);
    sqlite3_db_config(db, SQLITE_DBCONFIG_DQS_DML, 0, (void*)0);

I suppose a patch that just sets up these options when connecting to the database should not be too hard to come up with.
Comment 7 Michiel van Baak Jansen 2023-03-06 10:14:06 UTC
Just confirmed: the multimedia/tautulli port is also affected.
Updating sqlite3 in my tautulli jail breaks it:

[tautulli.vanbaak.eu] [1/1] Upgrading sqlite3 from 3.40.1,1 to 3.41.0,1...

Log after this upgrade:
==> /var/db/tautulli/logs/tautulli.log <==
2023-03-06 11:11:20 - ERROR   :: ('CP Server Thread-7',) : Tautulli Database :: Database error: no such column: movie
2023-03-06 11:11:20 - WARNING :: ('CP Server Thread-7',) : Tautulli DataFactory :: Unable to execute database query for get_home_stats: top_movies: no such column: movie.

Rolling back the sqlite3 upgrade fixes it
Comment 8 Michiel van Baak Jansen 2023-03-06 15:56:10 UTC
Created attachment 240620 [details]
tautulli log
Comment 9 Michiel van Baak Jansen 2023-03-06 15:57:09 UTC
Reported issue with upstream tautulli: https://github.com/Tautulli/Tautulli/issues/2015
Comment 10 Michiel van Baak Jansen 2023-03-08 08:51:23 UTC
(In reply to Matt from comment #2)

sonarr fixed the issue upstream, update to the port is here: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=270004
Comment 11 Robert Clausecker freebsd_committer freebsd_triage 2023-04-28 09:17:55 UTC
DQS is now disabled by default.  Can we close this ticket?
Comment 12 Michiel van Baak Jansen 2023-04-28 09:29:41 UTC
(In reply to Robert Clausecker from comment #11)

ok by me.
Comment 13 Robert Clausecker freebsd_committer freebsd_triage 2023-04-28 09:57:17 UTC
The DQS option has been temporarily reinstated to give ports some time to fix their queries.  It will be turned off permanently on 2024-01-01.