-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
500 error accessing dashboard after upgrade to 1.16.1 from 1.15.10, caused by mismatched SQLite colmun type #18650
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
Comments
Could you paste more logs before this log and after? |
And could you paste your database table |
This is the first log line in
This is the requested table structure (in v1.15.10 DB):
|
The error is coming from the sqlite DB itself and it indicates that one or more of the rows of action has a string value in one of its integer columns. How this has happened I do not know. Gitea shouldn't have done this directly. Have you restored from a cross db backup previously? The problem is that this cannot be automatically fixed. You're going to have to look at the sqlite DB yourself using sqlitebrowser or sqlite3. My suspicion is going to be that one of the is_ prefixed columns contains "true" and/or "false" when they should be 1 or 0. |
Maybe related to The SQLite database was corrupted |
The database worked correctly up to 1.15.10.
My steps:
This is a good starting point, thanks. |
There should be no need to stop the service to just read the data - sqlite will not take a lock unless you start writing to the db and once you write the lock will be released. The issue would come if you start editing data but don't write it immediately as that will lock the table and gitea will hold-up until you release that lock. |
I've checked The first 5 records in the table (id 118 ->122) have some differences with all the others:
Could it be that those 5 leading records are causing the issue? |
You can try to deleting them after you have a backup. |
It worked: after deleting those 5 records I can now access toe dashboard without errors, thanks! Just wondering what I've lost by deleting them and if there's a way to fix and re-adding them back... |
These records are not important, they are used used to show user activities, so you can safely delete them (I even truncated the It seems that empty Is your database created by a very old Gitea? |
Ok, I've suspected that... can live without them 😉
Yes it is. |
But I think the |
I think so, but it didn't cause any issue till 1.15.10. |
No, I have reviewed the whole history, it changed a lot. |
Even if v1.0.0 the field has been there. https://github.com/go-gitea/gitea/blob/v1.0.0/models/action.go#L86 |
The previous commit of v1.0.0 doesn't have that field. https://github.com/go-gitea/gitea/blame/0c9a616326ba096a2ff6c058cc96950f68c0fa6e/models/action.go And I am not sure whether there are something wrong occurs during SQLite migrations since the field type/index all changed a lot. Well, this is just a guess. @nicorac can you help to check what's the earliest |
It's |
Well, not that early 😂 I have no idea |
should be fixed at #19629 ? |
Yes, #19629 will fix the problem of the rows that have a |
A null
Figuring out the root cause would require more information:
What is puzzling is that there are no fields in Action that Find would need to convert from string to int64... |
I do not think they are the same problem. The problem in this issue is caused by incorrect database value, it might be caused by incorrect SQLite database operations (eg: incorrect upgrade/downgrade, incorrect dump/restore, etc) or unknown bugs (eg: during migration). There is a chance that #19629 could bypass the problem, but the data in SQLite database is still incorrect. I would propose to close this issue since there is no clue. Other databases won't be affected by this problem either. And this problem can be bypassed manually (easily) by truncating |
Why ? |
I do not understand this sentence. How does that explain why other databases won't be affected by this problem? |
In SQLite, you can have
|
I did not know that, thanks for explaining. Since this problem can still exist for Gitea instances that run on SQLite, I propose this issue is left open. |
With these improvements to |
Gitea Version
1.16.1
Git Version
2.25.1
Operating System
Ubuntu Server 20.04 LTS
How are you running Gitea?
Running as service with binaries (
gitea-1.16.1-linux-amd64
).Database
SQLite
Can you reproduce the bug on the Gitea demo site?
No
Description
After upgrading from
1.15.10
to1.16.1
I get a 500 error when accessing the dashboard.Other pages seem to work correctly if I open them directly (repos, issues, ...).
(the same issue happened a week ago when I tried to upgrade from
1.15.10
to1.16.0
but I haven't opened an issue at that time due to lack of time, sorry)Log contains only this relevant line:
Database version before update was
189
, after first run it was209
.I've reverted back to 1.15.10 (both binaries and DB).
The text was updated successfully, but these errors were encountered: