-
-
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
Clicking on an organization dashboard during a warehouse migration will report a 500 error #20804
Comments
When migrating a mirror, the mirror record hasn't been inserted into database at the beginning. |
It is when the organization is executing the repository migration task in the background, at this time the user accesses the link For example, a This error is only triggered when the organization is performing a migration task, and when the migration task is complete, the error disappears and access returns to normal |
In MirrorRepositoryList.loadAttributes there is some code to load the Mirror entries from the database. This assumes that every Repository which has IsMirror set has a Mirror associated in the DB. This association is incorrect in the case of Mirror repository under creation when there is no Mirror entry in the DB until completion. Unfortunately LoadAttributes makes this incorrect assumption and presumes that a Mirror will always be loaded. This then causes a panic. This PR simply double checks if there a Mirror before attempting to link back to its Repo. Unfortunately it should be expected that there may be other cases where this incorrect assumption causes further problems. Fix go-gitea#20804 Signed-off-by: Andrew Thornton <art27@cantab.net>
I've put up a PR to prevent the panic in this code but I think we need to look again at this code and consider whether it's even necessary to call it as I'm not sure that the value of .Mirrors is ever used... |
In MirrorRepositoryList.loadAttributes there is some code to load the Mirror entries from the database. This assumes that every Repository which has IsMirror set has a Mirror associated in the DB. This association is incorrect in the case of Mirror repository under creation when there is no Mirror entry in the DB until completion. Unfortunately LoadAttributes makes this incorrect assumption and presumes that a Mirror will always be loaded. This then causes a panic. This PR simply double checks if there a Mirror before attempting to link back to its Repo. Unfortunately it should be expected that there may be other cases where this incorrect assumption causes further problems. Fix #20804 Signed-off-by: Andrew Thornton <art27@cantab.net> Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
In MirrorRepositoryList.loadAttributes there is some code to load the Mirror entries from the database. This assumes that every Repository which has IsMirror set has a Mirror associated in the DB. This association is incorrect in the case of Mirror repository under creation when there is no Mirror entry in the DB until completion. Unfortunately LoadAttributes makes this incorrect assumption and presumes that a Mirror will always be loaded. This then causes a panic. This PR simply double checks if there a Mirror before attempting to link back to its Repo. Unfortunately it should be expected that there may be other cases where this incorrect assumption causes further problems. Fix go-gitea#20804 Signed-off-by: Andrew Thornton <art27@cantab.net> Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
In MirrorRepositoryList.loadAttributes there is some code to load the Mirror entries from the database. This assumes that every Repository which has IsMirror set has a Mirror associated in the DB. This association is incorrect in the case of Mirror repository under creation when there is no Mirror entry in the DB until completion. Unfortunately LoadAttributes makes this incorrect assumption and presumes that a Mirror will always be loaded. This then causes a panic. This PR simply double checks if there a Mirror before attempting to link back to its Repo. Unfortunately it should be expected that there may be other cases where this incorrect assumption causes further problems. Fix #20804 Signed-off-by: Andrew Thornton <art27@cantab.net> Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: zeripath <art27@cantab.net>
Whilst looking at go-gitea#20840 I noticed that the Mirrors data doesn't appear to be being used therefore we can remove this and in fact none of the related code is used elsewhere so it can also be removed. Related go-gitea#20840 Related go-gitea#20804 Signed-off-by: Andrew Thornton <art27@cantab.net>
Whilst looking at #20840 I noticed that the Mirrors data doesn't appear to be being used therefore we can remove this and in fact none of the related code is used elsewhere so it can also be removed. Related #20840 Related #20804 Signed-off-by: Andrew Thornton <art27@cantab.net> Signed-off-by: Andrew Thornton <art27@cantab.net>
Backport go-gitea#20855 Whilst looking at go-gitea#20840 I noticed that the Mirrors data doesn't appear to be being used therefore we can remove this and in fact none of the related code is used elsewhere so it can also be removed. Related go-gitea#20840 Related go-gitea#20804 Signed-off-by: Andrew Thornton <art27@cantab.net> Signed-off-by: Andrew Thornton <art27@cantab.net>
Backport #20855 Whilst looking at #20840 I noticed that the Mirrors data doesn't appear to be being used therefore we can remove this and in fact none of the related code is used elsewhere so it can also be removed. Related #20840 Related #20804 Signed-off-by: Andrew Thornton <art27@cantab.net> Signed-off-by: Andrew Thornton <art27@cantab.net> Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
In MirrorRepositoryList.loadAttributes there is some code to load the Mirror entries from the database. This assumes that every Repository which has IsMirror set has a Mirror associated in the DB. This association is incorrect in the case of Mirror repository under creation when there is no Mirror entry in the DB until completion. Unfortunately LoadAttributes makes this incorrect assumption and presumes that a Mirror will always be loaded. This then causes a panic. This PR simply double checks if there a Mirror before attempting to link back to its Repo. Unfortunately it should be expected that there may be other cases where this incorrect assumption causes further problems. Fix go-gitea#20804 Signed-off-by: Andrew Thornton <art27@cantab.net> Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Whilst looking at go-gitea#20840 I noticed that the Mirrors data doesn't appear to be being used therefore we can remove this and in fact none of the related code is used elsewhere so it can also be removed. Related go-gitea#20840 Related go-gitea#20804 Signed-off-by: Andrew Thornton <art27@cantab.net> Signed-off-by: Andrew Thornton <art27@cantab.net>
Description
When an organization is performing a repository migration task in the background, if you switch to the corresponding organization's dashboard in a new tab at this time, a 500 error is reported
In testing, I found that only the organization's dashboard had this problem, everything was fine for the user
Gitea Version
1.17.0
Can you reproduce the bug on the Gitea demo site?
No
Log Gist
No response
Screenshots
Git Version
2.36.2
Operating System
Ubuntu 22.04 LTS
How are you running Gitea?
Docker Deploy
Database
SQLite
The text was updated successfully, but these errors were encountered: