Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove "error:" prefix to SQLite warning message #10319

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jfroche
Copy link
Contributor

@jfroche jfroche commented Mar 25, 2024

Avoid the confusing error message "warning: error: SQLite database '/nix/var/nix/db/db.sqlite' is busy". Instead, just print "warning: ..." as the message.

Fixes #6656

Priorities and Process

Add 👍 to pull requests you find important.

The Nix maintainer team uses a GitHub project board to schedule and track reviews.

Avoid the confusing error message "warning: error: ..." when SQLite is
busy.  Instead, just print "warning: ..." as the message.

Fixes NixOS#6656
@edolstra
Copy link
Member

edolstra commented Mar 25, 2024

Wouldn't this work:

diff --git a/src/libstore/sqlite.cc b/src/libstore/sqlite.cc
index 06abfb90b..efe15b21b 100644
--- a/src/libstore/sqlite.cc
+++ b/src/libstore/sqlite.cc
@@ -249,7 +249,7 @@ void handleSQLiteBusy(const SQLiteBusy & e, time_t & nextWarning)
     if (now > nextWarning) {
         nextWarning = now + 10;
         logWarning({
-            .msg = HintFmt(e.what())
+            .msg = e.info().msg
         });
     }

@Ericson2314
Copy link
Member

Yeah please try @edolstra's fix. We want to treat the underlying disease (double rendering of error message) not the symptom (double level prefix).

@roberth
Copy link
Member

roberth commented Mar 28, 2024

(off topic)

underlying disease

Also what's causing starvation for over 10 seconds? Maybe registerValidPaths shouldn't hold a transaction while parsing derivations? Or maybe the backoffs are too long?

@edolstra
Copy link
Member

edolstra commented Apr 2, 2024

@roberth I think only subsequent warnings take 10 seconds. The first "busy" warning is printed immediately.

@roberth
Copy link
Member

roberth commented Apr 2, 2024

@roberth I think only subsequent warnings take 10 seconds. The first "busy" warning is printed immediately.

Ah, we were both wrong. First warning is after 1 second, and subsequent ones happen after 10 second intervals.

Starvation for 1 second is still bad though.

We'll need more info to really solve this. A quick search doesn't reveal a way to get useful info out of the WAL, so maybe we should do our own logging to a file, and add timestamps so that we can figure out after the fact what was blocking us.
It'd be tempting to just print what's currently blocking, but that'd be too little info, and possibly too much info, for security.

@roberth
Copy link
Member

roberth commented Apr 2, 2024

Just trying to get to the bottom of it. #10319 (comment) is still a good suggestion to move this PR forward.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SQLite database is busy -- warning or error?
4 participants