gitea: handleCreateError()] [E] CreatePost: database table is locked: repository'
-
Gitea version (or commit ref): Gitea 1.10
-
Git version: it version 2.7.4
-
Operating system: “Ubuntu 16.04.2 LTS”
-
Database (use
[x]):- PostgreSQL
- MySQL
- MSSQL
- SQLite
-
Can you reproduce the bug at https://try.gitea.io:
- Yes (provide example URL)
- No
- Not relevant
-
Log gist: In log/gitea.log
routers/repo/repo.go:103 handleCreateError()] [E] CreatePost: database table is locked: repository
Description
Creating a new repo would occasionally return HTTP code 500. …
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 17 (16 by maintainers)
The pattern used at https://github.com/go-gitea/gitea/blob/master/models/repo.go#L2000 is probably related.
See the pattern at the beginning of several related functions:
It looks like the intention is to emulate some kind of mutex lock, but the problem is the read and lock is not combined into an atomic operation. They are separated into
IsRunning()andStart()respectively. That could be problematic because there is no guarantee that, at the very moment after the call toIsRunningand beforeStart, another goroutine wouldn’t be launched and calling into the same sequence.Similar to #1434 and #1372 At least for #1372 it doesn’t have to do with load as I was the only one using the system at that point.
Once the new integration test is merged, we can add certain stress tests for such scenario. I am also thinking about migrate all global maps to syncmap gradually. That makes sense because gitea is a highly concurrent application.