Gitea: Hanging when creating a pull request (due allegedly to a huge repository)

Created on 25 Nov 2016  路  12Comments  路  Source: go-gitea/gitea

  • Gitea version (or commit ref):
    https://github.com/gogits/gogs/commit/8ee14db51ebc92728e1edba4545c7d4ea4b21c65
    This is exactly the Gogs release version 0.9.97.0901

  • Git version:
    git version 2.7.4

  • Operating system:
    `Ubuntu Server 16.04

  • Database (use [x]):

    • [ ] PostgreSQL
    • [ ] MySQL
    • [x] SQLite
  • Log gist:

31630 Nov 25 16:37:37 DIR-101 gogs[32041]: [Macaron] 2016-11-25 16:37:37: Started POST /test/BCM-Android-Linux-Test/compare/master...mura:master for 192.168.222.65
31631 Nov 25 16:37:37 DIR-101 gogs[32041]: 2016/11/25 16:37:37 [D] Session ID: f64a95bdfc4e1143
31632 Nov 25 16:37:37 DIR-101 gogs[32041]: 2016/11/25 16:37:37 [D] CSRF Token: cl6PKtu_cFKSebHPtlJdAv0Y9-k6MTQ4MDA1OTY5NjgzOTI2NTkzMA==
31633 Nov 25 16:37:37 DIR-101 gogs[32041]: 2016/11/25 16:37:37 [T] PullRequest[0].testPatch (patchPath): /home/git/gogs-repositories/test/bcm-android-linux-test.git/pulls/1.patch
31634 Nov 25 16:41:38 DIR-101 gogs[32041]: 2016/11/25 16:41:38 [T] PushToBaseRepo[37]: pushing commits to base repo 'refs/pull/1/head'
31635 Nov 25 16:41:38 DIR-101 gogs[32041]: 2016/11/25 16:41:38 [T] DeliverHooks [repo_id: 37]
31636 Nov 25 16:41:39 DIR-101 gogs[32041]: 2016/11/25 16:41:39 [T] Pull request created: 37/19
31637 Nov 25 16:41:39 DIR-101 gogs[32041]: [Macaron] 2016-11-25 16:41:39: Completed /test/BCM-Android-Linux-Test/compare/master...mura:master 302 Found in 4m1.573187867s
31638 Nov 25 16:41:39 DIR-101 gogs[32041]: [Macaron] 2016-11-25 16:41:39: Started GET /test/BCM-Android-Linux-Test/pulls/1 for 192.168.222.65
31639 Nov 25 16:41:39 DIR-101 gogs[32041]: 2016/11/25 16:41:39 [D] Session ID: f64a95bdfc4e1143
31640 Nov 25 16:41:39 DIR-101 gogs[32041]: 2016/11/25 16:41:39 [D] CSRF Token: cl6PKtu_cFKSebHPtlJdAv0Y9-k6MTQ4MDA1OTY5NjgzOTI2NTkzMA==
31641 Nov 25 16:41:39 DIR-101 gogs[32041]: 2016/11/25 16:41:39 [D] Template: repo/issue/view
31642 Nov 25 16:41:39 DIR-101 gogs[32041]: [Macaron] 2016-11-25 16:41:39: Completed /test/BCM-Android-Linux-Test/pulls/1 200 OK in 266.321449ms

Description

If I am not misinterpreting the log, it took around 4 minutes to reply the POST of the PR creation.
...

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

kinbug

Most helpful comment

It looks like git apply supports --check to only check w/out
applying. This should remove the need to clone the repository.

All 12 comments

Since you are posting this issue to Gitea, have you also tried the same with Gitea master? Just to confirm this is a remaining issue.

@tboerger Since the log was captured on a production server which is not entirely controlled by me, it's a bit of risky to upgrade and test the setup right now. I am trying to come up with a way to make it easier to be reproduced (and test it with latest Gitea).

The alleged culprit https://github.com/go-gitea/gitea/blob/master/models/pull.go#L342, according to the log.

I will mark it as a bug for now, but please try to provide more feedback on this.

@tboerger Confirmed. The latest Gitea exhibits the same behavior.

testPatch()
  UpdateLocalCopyBranch(branch string)
    UpdateLocalCopyBranch(repoPath, localPath, branch string)
        // Clone, Checkout, or Pull

The above is the relevant call trace for creating a PR.

The method testPatch is responsible for reporting the status of the PR. (PullRequestStatusConflict, PullRequestStatusChecking or PullRequestStatusMergeable)

The problem here is that Gogs/Gitea will try to clone or checkout the entire repository just for checking if there is any conflict. FWIW, the cloned repository will be stored at data/tmp.

It looks like git apply supports --check to only check w/out
applying. This should remove the need to clone the repository.

git read-tree --index-output=${INDEX_TMP_FILE} ${BRANCH_NAME}
GIT_INDEX_FILE=${INDEX_TMP_FILE} git apply --check --cached ${PATCH_FILE}

The above seems to be a viable approach to test patches with solely bare repository. I have tested on my laptop with a much simplified Gitea setup.

Moved like the pending pr to 1.1 because it requires further testing

So this has been resolved by #276 ?

@typeless

@lunny Yes.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ghost picture ghost  路  3Comments

jorise7 picture jorise7  路  3Comments

adpande picture adpande  路  3Comments

Fastidious picture Fastidious  路  3Comments

kifirkin picture kifirkin  路  3Comments