Something is causing a lock on some records on "repositories" table #660

Closed
opened 2025-11-02 03:32:11 -06:00 by GiteaMirror · 9 comments
Owner

Originally created by @andreynering on GitHub (Apr 21, 2017).

  • Gitea version (or commit ref): Current master (4bea219128)
  • Git version: git version 2.10.2.windows.1
  • Operating system:
  • 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: none

Description

I think it might be PostgreSQL specific, since I tried on try.gitea.io, which uses MariaDB, but couldn't reproduce.

In different installations I saw this issue where it isn't possible to update any information of a repository (e.g. change its name or if it's private or public) or even delete the repo. When you click the Update or Delete button, the request takes forever and nothing happens.

Doing some investigation I found that it's a lock issue in the DB. If I try to update or delete the record in my SQL editor it takes forever and never completes. But if I stop Gitea and try again than it works. If I start Gitea again the lock happens again.

I think it may be an issue with an migration or other startup action (probably a mising commit or rollback), but could not fint it yet. I'm posting here to know it anyone has any idea.

Originally created by @andreynering on GitHub (Apr 21, 2017). - Gitea version (or commit ref): Current master (4bea2191286dd5a9c89696d3e8cd506caf997c7e) - Git version: `git version 2.10.2.windows.1` - Operating system: - Database (use `[x]`): - [x] PostgreSQL - [ ] MySQL - [ ] MSSQL - [ ] SQLite - Can you reproduce the bug at https://try.gitea.io: - [ ] Yes (provide example URL) - [x] No - [ ] Not relevant - Log gist: none ## Description I think it might be PostgreSQL specific, since I tried on `try.gitea.io`, which uses MariaDB, but couldn't reproduce. In different installations I saw this issue where it isn't possible to update any information of a repository (e.g. change its name or if it's private or public) or even delete the repo. When you click the Update or Delete button, the request takes forever and nothing happens. Doing some investigation I found that it's a lock issue in the DB. If I try to update or delete the record in my SQL editor it takes forever and never completes. But if I stop Gitea and try again than it works. If I start Gitea again the lock happens again. I think it may be an issue with an migration or other startup action (probably a mising commit or rollback), but could not fint it yet. I'm posting here to know it anyone has any idea.
GiteaMirror added the issue/criticaltype/bug labels 2025-11-02 03:32:11 -06:00
Author
Owner

@lunny commented on GitHub (Apr 21, 2017):

Then have you tested before 4bea219's version ?

@lunny commented on GitHub (Apr 21, 2017): Then have you tested before 4bea219's version ?
Author
Owner

@lunny commented on GitHub (Apr 21, 2017):

I think this should be caused by #1332 which we just merged.

@lunny commented on GitHub (Apr 21, 2017): I think this should be caused by #1332 which we just merged.
Author
Owner

@bkcsoft commented on GitHub (Apr 21, 2017):

@andreynering Could you verify using this? https://wiki.postgresql.org/wiki/Lock_Monitoring

And get the last N lines from xorm.log :)

@bkcsoft commented on GitHub (Apr 21, 2017): @andreynering Could you verify using this? https://wiki.postgresql.org/wiki/Lock_Monitoring And get the last N lines from `xorm.log` :)
Author
Owner

@lunny commented on GitHub (Apr 21, 2017):

@andreynering But this PR is not related with repository operations. @bkcsoft a new question, we need delete all commitstatus when a repo will be deleted.

@lunny commented on GitHub (Apr 21, 2017): @andreynering But this PR is not related with repository operations. @bkcsoft a new question, we need delete all commitstatus when a repo will be deleted.
Author
Owner

@bkcsoft commented on GitHub (Apr 21, 2017):

@lunny Status-API isn't used by anything, and has no Foreign Keys to Repository either (that should probably be fixed though...). So I don't see how it could affect the DB at all 😕

@bkcsoft commented on GitHub (Apr 21, 2017): @lunny Status-API isn't used by anything, and has no Foreign Keys to Repository either (that should probably be fixed though...). So I don't see how it could affect the DB at all 😕
Author
Owner

@andreynering commented on GitHub (Apr 21, 2017):

I noticed this issue during this week, but it may exist even longer. So has nothing to do with the status API just merged.

@andreynering commented on GitHub (Apr 21, 2017): I noticed this issue during this week, but it may exist even longer. So has nothing to do with the status API just merged.
Author
Owner

@bkcsoft commented on GitHub (Apr 21, 2017):

Well, we found other issues in the Status-API PR anyhow so 💯 https://github.com/go-gitea/gitea/pull/1332#pullrequestreview-34055076 (Double Transactions ❤️ )

@bkcsoft commented on GitHub (Apr 21, 2017): Well, we found other issues in the Status-API PR anyhow so 💯 https://github.com/go-gitea/gitea/pull/1332#pullrequestreview-34055076 (Double Transactions ❤️ )
Author
Owner

@andreynering commented on GitHub (May 9, 2017):

After updating with current master, this was somehow fixed, but I have no idea how. 😱

@andreynering commented on GitHub (May 9, 2017): After updating with current master, this was somehow fixed, but I have no idea how. 😱
Author
Owner

@lunny commented on GitHub (May 10, 2017):

Since no PR to fix this, I moved it from 1.2.0

@lunny commented on GitHub (May 10, 2017): Since no PR to fix this, I moved it from 1.2.0
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#660