-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
Page not reacting while long-running migration/mirror initialization #3770
Comments
This really needs to be resolved, on large repos the page will timeout and break the repo causing a 500 error. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 weeks. Thank you for your contributions. |
Please review https://docs.gitea.io/en-us/config-cheat-sheet/ for |
This is not the cause of the issue... the issue is that the server waits until completion before sending the response page. |
Please reopen this issue! |
Thank you @kaeptmblaubaer1000 I think I understand the issue. https://github.com/go-gitea/gitea/blob/master/routers/repo/repo.go#L211 func MigratePost(ctx *context.Context, form auth.MigrateRepoForm) {
...
repo, err := models.MigrateRepository(ctx.User, ctxUser, models.MigrateRepoOptions{
Name: form.RepoName,
Description: form.Description,
IsPrivate: form.Private || setting.Repository.ForcePrivate,
IsMirror: form.Mirror,
RemoteAddr: remoteAddr,
})
...
} https://github.com/go-gitea/gitea/blob/master/models/repo.go#L899 func MigrateRepository(doer, u *User, opts MigrateRepoOptions) (*Repository, error) {
...
if err = git.Clone(opts.RemoteAddr, repoPath, git.CloneRepoOptions{
Mirror: true,
Quiet: true,
Timeout: migrateTimeout,
}); err != nil {
return repo, fmt.Errorf("Clone: %v", err)
}
...
} In the same goroutine as the POST! For big repositories this clone could take a very long time indeed. Meanwhile the user is sat on the other end of that POST waiting. |
The problem is how to fix this. Clearly we should put this clone in a separate goroutine and return. But we probably need to monitor the migration somehow. I guess a quick fix is to see if just sticking the clone and it's following parts in a goroutine is enough. |
The current code places the git clone in the POST goroutine, blocking that goroutine until it is finished. This PR asynchronises this, placing the clone within its own goroutine. Fix go-gitea#3770
This issue has been automatically closed because of inactivity. You can re-open it if needed. |
Not stale - sorry that was my fault for not removing the stale tag. It shouldn't happen anymore. |
@kaeptmblaubaer1000 is there any chance you could test my pr to see if it solves your issue? |
If it doesn't wait for completion of mirror / import clone before returning the response page, then it solved the issue... but unfortunately I can't test it, as I don't have Go on my computer (only on my phone) and I don't currently use Gitea anyway, because there is currently no need for it for me. |
@zeripath If you are currently running Gitea someplace try cloning the emoji-data repo (https://github.com/iamcal/emoji-data) if it continues and doesn't freeze AND you don't get a 500 error when you go to the repo in gitea then you've resolved the issue. If it freezes then it's not fixed and if you get a 500 error then that means that some sort of "Please Wait while we clone the Repo" page needs to be created and displayed. Note: the Emoji-Data repo is about 2GB (raw git) make sure you have enough space before cloning. |
Should be fixed as these have been moved into queues and now show "loading" icons for migration instead of just waiting until finished |
[x]
):Description
The response is delayed as long as the download takes.
It should rather either show that the download is in progress, or the progress (like GitHub Desktop does).
Screenshots
The text was updated successfully, but these errors were encountered: