[x]):I am running mailcow with gitea so I can authenticate users using their mail account. Yesterday I updated my mailcow stack and also Gitea with it. Since then Gitea doesn't launch. I tried to debug it and it looks like it gets stuck when it tries to run migration remove stale watches. If I specify another database file in my app.ini, so that Gitea creates a new one, everything seems to work and Gitea loads without any problems. However this means that I'd lose all my data, which is not a very good solution.
Can you check contents of gitea.log file, it should contain error where it fails
I checked the /var/lib/gitea/gitea/logs/gitea.log, xorm.log and serv.log, but there are no other logs. The log gist I gave you has all the log messages I am able to get my hands on.
Hmm is this an sqlite database? I wonder if you're hitting a deadlock somehow
Well, if migrating to different type of database is a possible solution I am down for it. However, I don't know would I do such a thing.
@KubqoA What was the version before the migration?
The logs you've printed refer to migration v67.go. the final log appears to be due to a select on the repository table and is probably this line: https://github.com/go-gitea/gitea/blob/d9b51a781cbdaeea53de9888831b33c680e43d46/models/migrations/v67.go#L92
Which probably shouldn't be x.Get but rather be sess.Get
So the issue is in that migration file?
It is the exact line @zeripath demonstrated.
So should I create a pull request so this can get fixed?
Yup. You're hitting an SQL deadlock in the v67 migration.
I recently did a check up of the rest of the codebase looking for deadlocks but skipped the migrations coz I assumed incorrectly that these would have been caught already. Clearly I need to check them aswell.
In your case this should be a very easy fix - although I won't be able to make a PR for several hours possibly not till Saturday so if someone else could do it I can lgtm it. The simplest way to prevent deadlocks is to ensure that all dependent db queries are done within the same transaction.
(You can be a bit cleverer but it will almost always bite you later.)
@KubqoA That would be nice 馃槃
Created the pull request @zeripath
Is this why upgrading to 1.7.0 isn't working?
@NetOperatorWibby without more information from you I couldn't possibly comment
Most helpful comment
The logs you've printed refer to migration v67.go. the final log appears to be due to a select on the repository table and is probably this line: https://github.com/go-gitea/gitea/blob/d9b51a781cbdaeea53de9888831b33c680e43d46/models/migrations/v67.go#L92
Which probably shouldn't be
x.Getbut rather besess.Get