Skip to content
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

Closed
2 of 7 tasks
kb-1000 opened this issue Apr 8, 2018 · 13 comments
Closed
2 of 7 tasks

Page not reacting while long-running migration/mirror initialization #3770

kb-1000 opened this issue Apr 8, 2018 · 13 comments
Labels
issue/confirmed Issue has been reviewed and confirmed to be present or accepted to be implemented type/enhancement An improvement of existing functionality

Comments

@kb-1000
Copy link

kb-1000 commented Apr 8, 2018

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

@lunny lunny added the type/enhancement An improvement of existing functionality label Apr 8, 2018
@tankerkiller125
Copy link

tankerkiller125 commented Dec 4, 2018

This really needs to be resolved, on large repos the page will timeout and break the repo causing a 500 error.

@stale
Copy link

stale bot commented Feb 2, 2019

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.

@stale stale bot added the issue/stale label Feb 2, 2019
@techknowlogick
Copy link
Member

Please review https://docs.gitea.io/en-us/config-cheat-sheet/ for git.timeout settings and increase the timeouts.

@kb-1000
Copy link
Author

kb-1000 commented Feb 3, 2019

This is not the cause of the issue... the issue is that the server waits until completion before sending the response page.

@kb-1000
Copy link
Author

kb-1000 commented Feb 3, 2019

Please reopen this issue!

@zeripath zeripath reopened this Feb 3, 2019
@zeripath zeripath added the issue/confirmed Issue has been reviewed and confirmed to be present or accepted to be implemented label Feb 3, 2019
@zeripath
Copy link
Contributor

zeripath commented Feb 3, 2019

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.

@zeripath
Copy link
Contributor

zeripath commented Feb 3, 2019

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.

zeripath added a commit to zeripath/gitea that referenced this issue Feb 4, 2019
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
@stale
Copy link

stale bot commented Feb 17, 2019

This issue has been automatically closed because of inactivity. You can re-open it if needed.

@stale stale bot closed this as completed Feb 17, 2019
@zeripath zeripath reopened this Feb 17, 2019
@stale stale bot removed the issue/stale label Feb 17, 2019
@zeripath
Copy link
Contributor

zeripath commented Feb 17, 2019

Not stale - sorry that was my fault for not removing the stale tag. It shouldn't happen anymore.

@zeripath
Copy link
Contributor

@kaeptmblaubaer1000 is there any chance you could test my pr to see if it solves your issue?

@kb-1000
Copy link
Author

kb-1000 commented Feb 18, 2019

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.

@tankerkiller125
Copy link

tankerkiller125 commented Feb 18, 2019

@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.

@mrsdizzie
Copy link
Member

Should be fixed as these have been moved into queues and now show "loading" icons for migration instead of just waiting until finished

@go-gitea go-gitea locked and limited conversation to collaborators Nov 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
issue/confirmed Issue has been reviewed and confirmed to be present or accepted to be implemented type/enhancement An improvement of existing functionality
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants