-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Internal error: database is locked (repo.go / serv.go) #1769
Comments
Complementary information: |
Could you test if this fixes the issue? #1961 (applying the diff and building on v1.1.2 should be straight forward) |
@bkcsoft This bug is hard to reproduce. My Gitea server has only got one per month since April. There were 10 cases in March though. Of course, the numbers have something to do with the variations of the user activities as well. It would be nice if there is a test that can reliably trigger the problem. |
@bkcsoft: Same for me, I cannot reliably trigger this problem. It's pretty random when it happens, though I suspect that in my case it's related to turning off the Raspberry Pi's power while it has a job/process running. |
One way of triggering it could be to have 10 users create PRs to the same repo at the same time. |
I think we should have the xorm library protect the db connection with a lock for SQLite. SQLite doesn't provide out-of-box multithreading safety for shared-single-connection-over-shared-cache scenario, which is how it is configured in Gitea. Otherwise Gitea would probably need to initiate a connection for every goroutine. P.S. The 'database table is locked' error can be reproduced, quite reliably, by our integration tests already. |
I agree that xorm library should protect sqlite connection from multiple threads |
continue via #2040 |
1.1.1 built with: bindata, sqlite
2.13.0
on client and2.12.2
on serverSQLite
Description
When trying to push sometimes gitea answers with:
[$] git push backup development -f Gitea: Internal error UpdatePublicKey: database is locked error: failed to push some refs to 'git@git-mirror:Artificial-Engineering/lycheejs.git'
When checking gitea via web interface everything seemed normal, no errors shown in dashboard or admin interface.
Afterwards I restarted the gitea service (using
systemctl stop gitea; systemctl start gitea
) and everything seems to work nicely again.The
gitea.log
file has these entries (literally hundreds of them):The
serv.log
contains this entry around the same time:The
xorm.log
file looks pretty normal, no errors, just some SQL queries and everything looks like when it worked afterwards.I thought I report this bug anyways, because I'm unsure whether something really painful can happen in future in case this happens again.
The text was updated successfully, but these errors were encountered: