Kareadita / Kavita

Kavita is a fast, feature rich, cross platform reading server. Built with the goal of being a full solution for all your reading needs. Setup your own server and share your reading collection with your friends and family.
http://www.kavitareader.com
GNU General Public License v3.0
6.31k stars 328 forks source link

Only spinner after migration to the latest #2706

Open ariedeleen opened 8 months ago

ariedeleen commented 8 months ago

What happened?

There was a popup window in Kavita with a warning. To use a different Docker image. So switched from kizaing/kavita:0.7.8.2 to jvmilazz0/kavita:latest (0.7.13.0) is now .14 Stopped the container switched the image and started up again.

But after that you could login to Kavita. But there was only a spinner. Running round and round. The 'structure' the left menu. Top bar is there but no 'data'. Also it is not possible to logout again.

Everything seems to be ok. Tried different browsers. Removed the cache. But in vain. So is there a way to solve this.

What did you expect?

Heaving a working Kavita webfront ;-P

Kavita Version Number - Don't see your version number listed? Then your install is out of date. Please update and see if your issue still persists.

0.7.14 - Stable

What operating system is Kavita being hosted from?

None

If the issue is being seen on Desktop, what OS are you running where you see the issue?

None

If the issue is being seen in the UI, what browsers are you seeing the problem on?

No response

If the issue is being seen on Mobile, what OS are you running where you see the issue?

None

If the issue is being seen on the UI, what browsers are you seeing the problem on?

No response

Relevant log output

ls -l /kavita/config/appsettings.json
[Kavita] [2024-02-10 09:38:51.658 +01:00  1] [Information] API.Services.TaskScheduler Scheduling reoccurring tasks
[Kavita] [2024-02-10 09:38:51.749 +01:00  1] [Information] API.Services.TaskScheduler Scheduling Auto-Update tasks
[Kavita] [2024-02-10 09:38:51.815 +01:00  1] [Information] API.Services.Tasks.Scanner.LibraryWatcher [LibraryWatcher] Starting file watchers for 1 library folders
[Kavita] [2024-02-10 09:38:52.191 +01:00  1] [Information] API.Services.Tasks.Scanner.LibraryWatcher [LibraryWatcher] Watching 1 folders
[Kavita] [2024-02-10 09:38:52.201 +01:00  6] [Information] API.Program Running Migrations
[Kavita] [2024-02-10 09:38:52.202 +01:00  6] [Fatal] API.Program Running MigrateUserLibrarySideNavStream migration - Please be patient, this may take some time. This is not an error
[Kavita] [2024-02-10 09:38:52.217 +01:00  6] [Fatal] API.Program Running MigrateUserLibrarySideNavStream migration - complete. Nothing to do
[Kavita] [2024-02-10 09:38:52.218 +01:00  6] [Fatal] API.Program Running MigrateSmartFilterEncoding migration - Please be patient, this may take some time. This is not an error
[Kavita] [2024-02-10 09:38:52.221 +01:00  6] [Fatal] API.Program Running MigrateSmartFilterEncoding migration - Completed. This is not an error
[Kavita] [2024-02-10 09:38:52.222 +01:00  6] [Fatal] API.Program Running MigrateLibrariesToHaveAllFileTypes migration - Please be patient, this may take some time. This is not an error
[Kavita] [2024-02-10 09:38:52.351 +01:00  6] [Fatal] API.Program Running MigrateLibrariesToHaveAllFileTypes migration - Completed. This is not an error
[Kavita] [2024-02-10 09:38:52.360 +01:00  6] [Information] API.Program Running Migrations - complete
[Kavita] [2024-02-10 09:38:52.517 +01:00  1] [Information] API.Program Starting with base url as /
[Kavita] [2024-02-10 09:38:52.560 +01:00  1] [Information] API.Program Kavita - v0.7.13.0

Additional Notes

Maybe this issue is already mentioned but couldn't find a relevant topic.

majora2007 commented 8 months ago

First off, thank you for updating. From the brief logs, it looks like all the migrations ran correctly.

First step I'd ask is to use an incognito window to try and load Kavita up to rule out any caching. You're updating nearly 8 months of releases in one go.

Let me know. Of those that have updated from 0.7.8, only one had a critical issue.

ariedeleen commented 8 months ago

Thanx for the reply. Tried incognito mode. And ctrl F5. Updating in steps to jvmilazz0/kavita:nightly-0.7.8.7 goes well. jvmilazz0/kavita:nightly-0.7.8.8 gives a sql error. But it works so so. See log sql error.

Updating to jvmilazz0/kavita:nightly-0.7.8.9 then there is no 'data' anymore. And there are no obvious errors in the log. It looks the same as 0.7.13.0

"[Kavita] [2024-02-10 16:03:33.244 +01:00 6] [Information] API.Program Running Migrations - complete [Kavita] [2024-02-10 16:03:33.388 +01:00 1] [Information] API.Startup Starting with base url as / Kavita - v0.7.8.9"

Running Kavita in different browsers. Even Opera ;-P In incognito mode. It is possible to login. But then there is only the spinner.

Part of log 0.7.8.8: "Kavita] [2024-02-10 15:34:15.450 +01:00 54] [Error] Microsoft.EntityFrameworkCore.Database.Command Failed executing DbCommand (78ms) [Parameters=[], CommandType='"Text"', CommandTimeout='30'] SELECT "s"."Id", "s"."AppUserId", "s"."AvgHoursToRead", "s"."CoverImage", "s"."CoverImageLocked", "s"."Created", "s"."CreatedUtc", "s"."FolderPath", "s"."Format", "s"."LastChapterAdded", "s"."LastChapterAddedUtc", "s"."LastFolderScanned", "s"."LastFolderScannedUtc", "s"."LastModified", "s"."LastModifiedUtc", "s"."LibraryId", "s"."LocalizedName", "s"."LocalizedNameLocked", "s"."MaxHoursToRead", "s"."MinHoursToRead", "s"."Name", "s"."NormalizedLocalizedName", "s"."NormalizedName", "s"."OriginalName", "s"."Pages", "s"."SortName", "s"."SortNameLocked", "s"."WordCount", "a"."Id", "a"."AppUserId", "a"."BookScrollId", "a"."ChapterId", "a"."Created", "a"."CreatedUtc", "a"."LastModified", "a"."LastModifiedUtc", "a"."LibraryId", "a"."PagesRead", "a"."SeriesId", "a"."VolumeId" FROM "AppUserProgresses" AS "a" INNER JOIN "Series" AS "s" ON "a"."SeriesId" = "s"."Id" [Kavita] [2024-02-10 15:34:15.450 +01:00 54] [Error] Microsoft.EntityFrameworkCore.Query An exception occurred while iterating over the results of a query for context type 'API.Data.DataContext'. Microsoft.Data.Sqlite.SqliteException (0x80004005): SQLite Error 1: 'no such column: s.AppUserId''

The rest of the log is in the txt attachment. Also the red warning. In png.

SQLite Error 1: 'no such column: s.AppUserId'' this warning also in red on the webfront. In the right bottom. admin/dashboard#statistics

kavitalog.txt sqlerror

majora2007 commented 8 months ago

Okay hold on, you are not updating correctly. You are updating to nightlies which you shouldn't do. Nightlies are like beta releases in-between the stables. If you are on a stable, you shouldn't use them. They can have breaking changes in there.

You just need to go from v0.7.8.2 directly to v0.7.14. Every migration will run. You can grab a backup from config/backups and retry for me.

SQLite Error 1: 'no such column: s.AppUserId'' This is an Okay issue if you are on the latest, but it shouldn't show up in the UI. It implies the update didn't go smoothly.

Let's just retry from the beginning and see what happens. A user today just updated from v0.7.8.2 to latest and only issue they had was they didn't mount their config volume correctly.

ariedeleen commented 8 months ago

Yes, that's what I did in the first place, But that did't work. It gave me the spinner. So I was hoping that incremental steps would work. I will try it again from kizaing/kavita:0.7.8.2 to jvmilazz0/kavita:latest and let you know.

majora2007 commented 8 months ago

Make sure that you are restoring your OLD db from backup or temp/migrations/v0.7.8.2/kavita.db when you're attempting to update. Feel free to send me logs and I can look over them.

ariedeleen commented 8 months ago

Made a Kavita dev. Copied kavita.db 0.7.8.2 from the live (first stopped it) running with kizaing/kavita:0.7.8.2 image to the dev environment and it runs just fine. On a different network port. admin/dashboard#system Version 0.7.8.2

Then I stopped the dev container. Swapped the image to jvmilazz0/kavita:latest. Start it up again. Cleared browser cache. I can log in. But then only the spinner. And lots of page errors in the browser developer console. See image.

When I do not refresh the browser, Kavita 0.7.14 is working? It shows 0.7.14. Strangely. After a browser refresh its spinner time again. And after a dozen refreshes ctrl F5 the /admin/dashboard is back, For a moment. Tried different browsers. In privacy mode. And directly local ip address. Not via a reverse proxy. Normally it's the other way around. Clear the cache to get a working page/website. Scratching my head here,

There are two files in the Kavita root folder namely: imported-want-to-read-migration.csv and want-to-read-migration.csv see dropped in files. attached log files and a screenshot. Thanx in advance.

screenshotafterupdate kavitalog_afterupdatetolatestversion.txt imported-want-to-read-migration.csv want-to-read-migration.csv kavita20240210.log

majora2007 commented 8 months ago

Hmm Okay, so I do see the "error".

Would you mind emailing me or DMing me via discord (same name) your DB? I think the issue is that the migration (which produces the want-to-read-migration.csv) is failing to remove the AppUserId from the Series Table. At some point it got added when Want To Read was added and I recently removed it in this latest stable.

I'm not 100% sure as just this morning someone updated successfully from v0.7.8.2 as well, no issues. Only thing I can think of is AppUserId column is or isn't on Series which is causing some error (but it shouldn't). Otherwise, I'd need to check the DB.

Do you have any custom Smart Filters bound to your Dashboard or Side Nav?

ariedeleen commented 8 months ago

Oops, one Kavita user is using https://github.com/Snd-R/komf-userscript. Could that be the trouble? Totally forgotten about that. Pfff. I will "slap him around with a large wet trout" ;-P if that's the case. I also updated another Kavita instance. same way, on an other server. Without komf-userscript That went well, It a SQLite db. Can I run a sql 'query' instruction myself in for example in the DB Browser for SQlite software tool. Or is it a (to) deep dive in the tables and joins etc. I am orkey3364 on Discord. Send over two db files. 0.7.8.2 old(kavita_old_b4updating.db) and 0.7.14.0 (kavita_new_notworking.db) Hopefully the upload worked.

majora2007 commented 8 months ago

I'm not sure about the komf userscript, it shouldn't cause any issue.

Please re-add me as a friend on discord (or you can use something like wetransfer and send me the db without going through the friend process)

Can you run this SQL on your db? Select AppUserId, Id from Series WHERE AppUserId IS NOT NULL ORDER BY AppUserId;

I really just want to understand if the AppUserId is still in your series or not. This shouldn't actually cause any issues, but it is step 1 in debugging the underlying issue.

ariedeleen commented 8 months ago

Results after running the query on the old and the new db.

old db b4 updating: 0.7.8.2 Result: 1 rows returned in 26ms At line 1: Select AppUserId, Id from Series WHERE AppUserId IS NOT NULL ORDER BY AppUserId;

new db after updating to 0.7.14.0 Result: near "Result": syntax error At line 1: Result

majora2007 commented 8 months ago

Okay that's perfect. I saw your friend request, please drop me the databases when you can and I'll debug today.

ariedeleen commented 8 months ago

Dropped the databases from before and after. Thanks again

ariedeleen commented 8 months ago

Did some comparing between the old and the new database. Try to figure out what's causing the spinner. So far diffed the databases. As a start... In windows I have used https://github.com/shuebener/SQLiteCompare/releases/tag/v3.0.0.0 see image. Nice graphical tool.

In Linux I have used:

sqlite3 kavitaold.db .dump > kavitaold.sql sqlite3 kavitanew.db .dump > kavitnew.sql diff -u kavitaold.sql kavitanew.sql > diff.txt

databasecompare

majora2007 commented 8 months ago

You're going to want to look at the __EFMigrationsHistory table, which will have the different migrations. That is how we identify if migrations were ran or not. Likewise, in ServerSettings, there is a row with the version that the DB was running (unless the migrations were successful).

ariedeleen commented 8 months ago

docker pull kizaing/kavita:0.7.8.2 runs docker pull jvmilazz0/kavita:nightly-0.7.8.2 runs also

docker pull jvmilazz0/kavita:0.7.9 nope not even a spinner.

Not from kizaing/kavita:0.7.8.2 or from jvmilazz0/kavita:nightly-0.7.8.2 to jvmilazz0/kavita:0.7.9 tried both.

Diffed the databases. Not much going on.

__EFMigrationsHistory table both sides are empty.

Table ServerSetting key11 changed from 0.7.8.0 to 0.7.9.0

Next maybe comparing the docker images.

DieselTech commented 6 months ago

@ariedeleen Did you ever get to the bottom of this?

ariedeleen commented 6 months ago

Oops, totally missed your comment. No never ever got an answer or solution myself to this problem.