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

CI fails with strange errors (randomly) #17719

Closed
wxiaoguang opened this issue Nov 18, 2021 · 3 comments
Closed

CI fails with strange errors (randomly) #17719

wxiaoguang opened this issue Nov 18, 2021 · 3 comments

Comments

@wxiaoguang
Copy link
Contributor

wxiaoguang commented Nov 18, 2021

There are many strange errors occurring randomly during CI.

These errors are false positive, and make the CI fail, and then maintainers must spend more time to restart a CI build and wait .....

This issue records them, and hopefully we can resolve them to speed up the CI/merge workflow.

Case 1

Unexpected redirect in TestAPICreateComment with failed authentication
=== TestAPICreateComment (integrations/api_comment_test.go:89)
--- FAIL: TestAPICreateComment (1.19s)
    testlogger.go:78: 2021/11/18 17:07:26 ...ers/common/logger.go:21:1() [I] Started GET /user/login for 
    testlogger.go:78: 2021/11/18 17:07:26 ...ers/common/logger.go:30:1() [I] Completed GET /user/login 200 OK in 9.255831ms
    testlogger.go:78: 2021/11/18 17:07:26 ...ers/common/logger.go:21:1() [I] Started POST /user/login for 
    testlogger.go:78: 2021/11/18 17:07:27 ...ers/common/logger.go:30:1() [I] Completed POST /user/login 302 Found in 599.146332ms
    testlogger.go:78: 2021/11/18 17:07:27 ...ers/common/logger.go:21:1() [I] Started GET /user/settings/applications for 
    testlogger.go:78: 2021/11/18 17:07:27 ...ules/context/auth.go:36:func1() [I] Failed authentication attempt for org26 from 
    testlogger.go:78: 2021/11/18 17:07:27 ...ers/common/logger.go:30:1() [I] Completed GET /user/settings/applications 200 OK in 15.571413ms
    testlogger.go:78: 2021/11/18 17:07:27 ...ers/common/logger.go:21:1() [I] Started POST /user/settings/applications for 
    testlogger.go:78: 2021/11/18 17:07:27 ...ules/context/auth.go:36:func1() [I] Failed authentication attempt for org26 from 
    testlogger.go:78: 2021/11/18 17:07:27 ...ers/common/logger.go:30:1() [I] Completed POST /user/settings/applications 200 OK in 15.382133ms
    api_comment_test.go:97: 
        	Error Trace:	integration_test.go:452
        	            				integration_test.go:285
        	            				integration_test.go:390
        	            				api_comment_test.go:97
        	Error:      	Not equal: 
        	            	expected: 302
        	            	actual  : 200
        	Test:       	TestAPICreateComment
        	Messages:   	Request: POST /user/settings/applications
    testlogger.go:78: 2021/11/18 17:07:27 ...ers/common/logger.go:21:1() [I] Started GET /user/settings/applications for 
    testlogger.go:78: 2021/11/18 17:07:27 ...ules/context/auth.go:36:func1() [I] Failed authentication attempt for org26 from 
    testlogger.go:78: 2021/11/18 17:07:27 ...ers/common/logger.go:30:1() [I] Completed GET /user/settings/applications 200 OK in 20.578871ms
    testlogger.go:78: 2021/11/18 17:07:27 ...ers/common/logger.go:21:1() [I] Started POST /api/v1/repos/org26/repo_external_tracker_alpha/issues/1/comments?token= for 
    testlogger.go:78: 2021/11/18 17:07:27 ...ules/context/auth.go:119:func1() [I] Failed authentication attempt for org26 from 
    testlogger.go:78: 2021/11/18 17:07:27 ...ers/common/logger.go:30:1() [I] Completed POST /api/v1/repos/org26/repo_external_tracker_alpha/issues/1/comments?token= 403 Forbidden in 5.680419ms
    api_comment_test.go:103: 
        	Error Trace:	integration_test.go:452
        	            				integration_test.go:285
        	            				api_comment_test.go:103
        	Error:      	Not equal: 
        	            	expected: 201
        	            	actual  : 403
        	Test:       	TestAPICreateComment
        	Messages:   	Request: POST /api/v1/repos/org26/repo_external_tracker_alpha/issues/1/comments?token=
    api_comment_test.go:103: Response: {"message":"This account is prohibited from signing in, please contact your site administrator."}
        
    api_comment_test.go:107: 
        	Error Trace:	api_comment_test.go:107
        	Error:      	Not equal: 
        	            	expected: "Comment body"
        	            	actual  : ""
        	            	
        	            	Diff:
        	            	--- Expected
        	            	+++ Actual
        	            	@@ -1 +1 @@
        	            	-Comment body
        	            	+
        	Test:       	TestAPICreateComment
    unit_tests.go:61: 
        	Error Trace:	unit_tests.go:61
        	            				api_comment_test.go:108
        	Error:      	Should be true
        	Test:       	TestAPICreateComment
        	Messages:   	Expected to find &{ID:0 Type:0 PosterID:0 Poster:<nil> OriginalAuthor: OriginalAuthorID:0 IssueID:9 Issue:<nil> LabelID:0 Label:<nil> AddedLabels:[] RemovedLabels:[] OldProjectID:0 ProjectID:0 OldProject:<nil> Project:<nil> OldMilestoneID:0 MilestoneID:0 OldMilestone:<nil> Milestone:<nil> TimeID:0 Time:<nil> AssigneeID:0 RemovedAssignee:false Assignee:<nil> AssigneeTeamID:0 AssigneeTeam:<nil> ResolveDoerID:0 ResolveDoer:<nil> OldTitle: NewTitle: OldRef: NewRef: DependentIssueID:0 DependentIssue:<nil> CommitID:0 Line:0 TreePath: Content:Comment body RenderedContent: Patch: PatchQuoted: CreatedUnix:0 UpdatedUnix:0 CommitSHA: Attachments:[] Reactions:[] ShowRole:0 Review:<nil> ReviewID:0 Invalidated:false RefRepoID:0 RefIssueID:0 RefCommentID:0 RefAction:0 RefIsPull:false RefRepo:<nil> RefIssue:<nil> RefComment:<nil> Commits:[] OldCommit: NewCommit: CommitsNum:0 IsForcePush:false} (of type *models.Comment, with conditions []), but did not

Case 2 - Should be fixed by #18451

TestGit/SSH/BranchProtectMerge/MergePR failure to merge due to PR not being ready to merge
testlogger.go:78: 2021/11/18 17:45:59 ...ers/common/logger.go:21:1() [I] Started POST /api/internal/hook/pre-receive/user2/repo-tmp-18 for 127.0.0.1:41498
testlogger.go:78: 2021/11/18 17:45:59 ...ers/common/logger.go:30:1() [I] Completed POST /api/internal/hook/pre-receive/user2/repo-tmp-18 200 OK in 7.550826ms
testlogger.go:78: 2021/11/18 17:45:59 ...ers/common/logger.go:21:1() [I] Started POST /api/internal/hook/post-receive/user2/repo-tmp-18 for 127.0.0.1:41502
testlogger.go:78: 2021/11/18 17:46:03 ...ers/common/logger.go:30:1() [I] Completed POST /api/internal/hook/post-receive/user2/repo-tmp-18 200 OK in 4.54430386s
testlogger.go:78: 2021/11/18 17:46:09 ...ers/common/logger.go:30:1() [I] Completed POST /api/v1/repos/user2/repo-tmp-18/pulls/4/merge?token=f35abe897655a5b8d1f540d1a3aaea0b664820fd 200 OK in 11.747130241s
testlogger.go:78: 2021/11/18 17:46:09 ...ers/common/logger.go:21:1() [I] Started POST /api/v1/repos/user2/repo-tmp-18/pulls/3/merge?token=f35abe897655a5b8d1f540d1a3aaea0b664820fd for 
testlogger.go:78: 2021/11/18 17:46:09 ...ervices/pull/pull.go:446:pushToBaseRepoHelper() [I] Unable to push PR head for user2/repo-tmp-18#3 (73:user2/repo-tmp-18:refs/pull/3/head) due to rejection:
     Stdout: 
     Stderr: remote: error: cannot lock ref 'refs/pull/3/head': is at 85e92109f8cce923c2953cc7562d337ac7466304 but expected 61b09b17fa4f38641aebff63b9ce6ad89d05bb33        
     To /tmp/tmp.I9Z8Kuxotw/integrations/gitea-integration-sqlite/gitea-repositories/user2/repo-tmp-18.git
      ! [remote rejected] unprotected -> refs/pull/3/head (failed to update ref)
     error: failed to push some refs to '/tmp/tmp.I9Z8Kuxotw/integrations/gitea-integration-sqlite/gitea-repositories/user2/repo-tmp-18.git'
     
     Error: exit status 1
testlogger.go:78: 2021/11/18 17:46:09 ...ervices/pull/pull.go:292:func1() [E] PushToBaseRepo: PushRejected Error: exit status 1: remote: error: cannot lock ref 'refs/pull/3/head': is at 85e92109f8cce923c2953cc7562d337ac7466304 but expected 61b09b17fa4f38641aebff63b9ce6ad89d05bb33        
     To /tmp/tmp.I9Z8Kuxotw/integrations/gitea-integration-sqlite/gitea-repositories/user2/repo-tmp-18.git
      ! [remote rejected] unprotected -> refs/pull/3/head (failed to update ref)
     error: failed to push some refs to '/tmp/tmp.I9Z8Kuxotw/integrations/gitea-integration-sqlite/gitea-repositories/user2/repo-tmp-18.git'
     
     
testlogger.go:78: 2021/11/18 17:46:10 ...ers/common/logger.go:30:1() [I] Completed POST /api/v1/repos/user2/repo-tmp-18/pulls/3/merge?token=f35abe897655a5b8d1f540d1a3aaea0b664820fd 405 Method Not Allowed in 1.122442548s
testlogger.go:78: 2021/11/18 17:46:10 ...ers/common/logger.go:21:1() [I] Started POST /api/v1/repos/user2/repo-tmp-18/pulls/3/merge?token=f35abe897655a5b8d1f540d1a3aaea0b664820fd for 
testlogger.go:78: 2021/11/18 17:46:10 ...ers/common/logger.go:30:1() [I] Completed POST /api/v1/repos/user2/repo-tmp-18/pulls/3/merge?token=f35abe897655a5b8d1f540d1a3aaea0b664820fd 405 Method Not Allowed in 652.840529ms
--- FAIL: TestGit/SSH/BranchProtectMerge/MergePR (1.78s)
    api_helper_for_declarative_test.go:288: 
         Error Trace:	api_helper_for_declarative_test.go:288
         Error:      	Not equal: 
                    	 expected: 200
                    	 actual  : 405
         Test:       	TestGit/SSH/BranchProtectMerge/MergePR
         Messages:   	Request: POST /api/v1/repos/user2/repo-tmp-18/pulls/3/merge?token=f35abe897655a5b8d1f540d1a3aaea0b664820fd
    api_helper_for_declarative_test.go:290: Response: {"message":"Please try again later","url":"http://localhost:3003/api/swagger"}





testlogger.go:78: 2021/11/18 17:46:13 ...ers/common/logger.go:21:1() [I] Started POST /user2/repo-tmp-18.git/info/lfs/locks/verify for 127.0.0.1:41578
testlogger.go:78: 2021/11/18 17:46:13 ...ers/common/logger.go:30:1() [I] Completed POST /user2/repo-tmp-18.git/info/lfs/locks/verify 200 OK in 5.92406ms
testlogger.go:78: 2021/11/18 17:46:13 ...ers/common/logger.go:21:1() [I] Started POST /api/internal/hook/pre-receive/user2/repo-tmp-18 for 127.0.0.1:41594
testlogger.go:78: 2021/11/18 17:46:13 .../hook_pre_receive.go:287:preReceiveBranch() [W] Forbidden: User 2 is not allowed to push to protected branch: protected in 73:user2/repo-tmp-18
testlogger.go:78: 2021/11/18 17:46:13 ...ers/common/logger.go:30:1() [I] Completed POST /api/internal/hook/pre-receive/user2/repo-tmp-18 403 Forbidden in 16.293496ms
testlogger.go:78: 2021/11/18 17:46:13 ...ers/common/logger.go:21:1() [I] Started POST /api/internal/ssh/9/update/73 for 127.0.0.1:41596
testlogger.go:78: 2021/11/18 17:46:13 ...ers/common/logger.go:30:1() [I] Completed POST /api/internal/ssh/9/update/73 200 OK in 2.069807ms
--- FAIL: TestGit/SSH/BranchProtectMerge/PushUnprotectedFilesToProtectedBranch (0.73s)
    git_helper_for_declarative_test.go:167: 
         Error Trace:	git_helper_for_declarative_test.go:167
         Error:      	Received unexpected error:
                    	 exit status 1 - Warning: Permanently added '[localhost]:2203' (RSA) to the list of known hosts.
                    	 remote: 
                    	 remote: Gitea: Not allowed to push to protected branch protected        
                    	 remote: Gitea: Not allowed to push to protected branch protected        
                    	 To ssh://localhost:2203/user2/repo-tmp-18.git
                    	  ! [remote rejected] protected -> protected (pre-receive hook declined)
                    	 error: failed to push some refs to 'ssh://localhost:2203/user2/repo-tmp-18.git'
         Test:       	TestGit/SSH/BranchProtectMerge/PushUnprotectedFilesToProtectedBranch
testlogger.go:78: 2021/11/18 17:46:13 ...ers/common/logger.go:21:1() [I] Started GET /user2/repo-tmp-18/settings/branches for 
testlogger.go:78: 2021/11/18 17:46:13 ...ers/common/logger.go:30:1() [I] Completed GET /user2/repo-tmp-18/settings/branches 200 OK in 95.450569ms
testlogger.go:78: 2021/11/18 17:46:13 ...ers/common/logger.go:21:1() [I] Started POST /user2/repo-tmp-18/settings/branches/protected for 
testlogger.go:78: 2021/11/18 17:46:13 ...ers/common/logger.go:30:1() [I] Completed POST /user2/repo-tmp-18/settings/branches/protected 302 Found in 120.125774ms
testlogger.go:78: 2021/11/18 17:46:13 ...ers/common/logger.go:21:1() [I] Started GET /api/internal/serv/command/9/user2/repo-tmp-18?mode=2&verb=git-receive-pack for 127.0.0.1:41604
testlogger.go:78: 2021/11/18 17:46:13 ...ers/common/logger.go:30:1() [I] Completed GET /api/internal/serv/command/9/user2/repo-tmp-18?mode=2&verb=git-receive-pack 200 OK in 7.533106ms
testlogger.go:78: 2021/11/18 17:46:14 ...ers/common/logger.go:21:1() [I] Started GET /api/internal/serv/command/9/user2/repo-tmp-18?mode=1&verb=git-upload-pack for 127.0.0.1:41610
testlogger.go:78: 2021/11/18 17:46:14 ...ers/common/logger.go:30:1() [I] Completed GET /api/internal/serv/command/9/user2/repo-tmp-18?mode=1&verb=git-upload-pack 200 OK in 7.120025ms
testlogger.go:78: 2021/11/18 17:46:14 ...ers/common/logger.go:21:1() [I] Started POST /api/internal/ssh/9/update/73 for 127.0.0.1:41612
testlogger.go:78: 2021/11/18 17:46:14 ...ers/common/logger.go:30:1() [I] Completed POST /api/internal/ssh/9/update/73 200 OK in 7.340665ms
testlogger.go:78: 2021/11/18 17:46:14 ...ers/common/logger.go:21:1() [I] Started GET /api/internal/serv/command/9/user2/repo-tmp-18?mode=2&verb=git-lfs-authenticate&verb=upload for 127.0.0.1:41618
testlogger.go:78: 2021/11/18 17:46:14 ...ers/common/logger.go:30:1() [I] Completed GET /api/internal/serv/command/9/user2/repo-tmp-18?mode=2&verb=git-lfs-authenticate&verb=upload 200 OK in 8.043387ms
testlogger.go:78: 2021/11/18 17:46:14 ...ers/common/logger.go:21:1() [I] Started POST /user2/repo-tmp-18.git/info/lfs/locks/verify for 127.0.0.1:41620
testlogger.go:78: 2021/11/18 17:46:14 ...ers/common/logger.go:30:1() [I] Completed POST /user2/repo-tmp-18.git/info/lfs/locks/verify 200 OK in 6.572022ms
testlogger.go:78: 2021/11/18 17:46:14 ...ers/common/logger.go:21:1() [I] Started POST /api/internal/hook/pre-receive/user2/repo-tmp-18 for 127.0.0.1:41624
testlogger.go:78: 2021/11/18 17:46:14 ...ers/common/logger.go:30:1() [I] Completed POST /api/internal/hook/pre-receive/user2/repo-tmp-18 200 OK in 11.382359ms
testlogger.go:78: 2021/11/18 17:46:14 ...ers/common/logger.go:21:1() [I] Started POST /api/internal/hook/post-receive/user2/repo-tmp-18 for 127.0.0.1:41630
testlogger.go:78: 2021/11/18 17:46:14 ...ers/common/logger.go:30:1() [I] Completed POST /api/internal/hook/post-receive/user2/repo-tmp-18 200 OK in 69.156118ms
testlogger.go:78: 2021/11/18 17:46:14 ...ers/common/logger.go:21:1() [I] Started POST /api/internal/ssh/9/update/73 for 127.0.0.1:41640
testlogger.go:78: 2021/11/18 17:46:14 ...ers/common/logger.go:30:1() [I] Completed POST /api/internal/ssh/9/update/73 200 OK in 8.467389ms
--- FAIL: TestGit/SSH/BranchProtectMerge/FailToForcePushToProtectedBranch (1.01s)
    git_helper_for_declarative_test.go:174: 
         Error Trace:	git_helper_for_declarative_test.go:174
         Error:      	An error is expected but got nil.
         Test:       	TestGit/SSH/BranchProtectMerge/FailToForcePushToProtectedBranch
testlogger.go:78: 2021/11/18 17:46:14 ...ers/common/logger.go:21:1() [I] Started GET /api/internal/serv/command/9/user2/repo-tmp-18?mode=2&verb=git-receive-pack for 127.0.0.1:41646
testlogger.go:78: 2021/11/18 17:46:14 ...ers/common/logger.go:30:1() [I] Completed GET /api/internal/serv/command/9/user2/repo-tmp-18?mode=2&verb=git-receive-pack 200 OK in 7.437745ms

Case 3 - Likely fixed by #18444 - if not fixed it will be clearer.

NPE in TestEntries_GetCommitsInfo
2021/11/18 15:36:51 ...dules/git/command.go:141:RunWithContext() [D] /usr/bin/git version
2021/11/18 15:36:51 ...dules/git/command.go:229:RunInDirTimeoutEnv() [T] Stdout:
	 git version 2.33.0
	
2021/11/18 15:36:51 ...dules/git/command.go:143:RunWithContext() [D] /drone/src/modules/git/tests/repos/repo1_bare: /usr/bin/git -c credential.helper= -c protocol.version=2 cat-file --batch
2021/11/18 15:36:51 ...dules/git/command.go:143:RunWithContext() [D] /drone/src/modules/git/tests/repos/repo1_bare: /usr/bin/git -c credential.helper= -c protocol.version=2 cat-file --batch-check
2021/11/18 15:36:51 ...dules/git/command.go:141:RunWithContext() [D] /usr/bin/git -c credential.helper= -c protocol.version=2 --version
... (hundreds of line ....)
2021/11/18 15:37:01 ...dules/git/command.go:141:RunWithContext() [D] /usr/bin/git -c credential.helper= -c protocol.version=2 --version
2021/11/18 15:37:01 ...dules/git/command.go:141:RunWithContext() [D] /usr/bin/git -c credential.helper= -c protocol.version=2 hash-object --stdin
... (hundreds of line ....)
2021/11/18 15:37:03 ...dules/git/command.go:141:RunWithContext() [D] /usr/bin/git -c credential.helper= -c protocol.version=2 hash-object --stdin
2021/11/18 15:37:03 ...dules/git/command.go:143:RunWithContext() [D] /drone/src/modules/git/tests/repos/repo1_bare: /usr/bin/git -c credential.helper= -c protocol.version=2 cat-file --batch
2021/11/18 15:37:03 ...dules/git/command.go:143:RunWithContext() [D] /drone/src/modules/git/tests/repos/repo1_bare: /usr/bin/git -c credential.helper= -c protocol.version=2 cat-file --batch-check
2021/11/18 15:37:04 ...dules/git/command.go:143:RunWithContext() [D] /drone/src/modules/git/tests/repos/repo1_bare: /usr/bin/git -c credential.helper= -c protocol.version=2 log --name-status -c --format=commit%x00%H %P%x00 --parents --no-renames -t -z 8d92fc957a4d7cfd98bc375f0b7bb189a0d6c9f2 -- file1.txt file2.txt
2021/11/18 15:37:04 ...dules/git/command.go:143:RunWithContext() [D] /drone/src/modules/git/tests/repos/repo1_bare: /usr/bin/git -c credential.helper= -c protocol.version=2 log --name-status -c --format=commit%x00%H %P%x00 --parents --no-renames -t -z 8d92fc957a4d7cfd98bc375f0b7bb189a0d6c9f2 -- file1.txt
2021/11/18 15:37:04 ...dules/git/command.go:143:RunWithContext() [D] /drone/src/modules/git/tests/repos/repo1_bare: /usr/bin/git -c credential.helper= -c protocol.version=2 log --name-status -c --format=commit%x00%H %P%x00 --parents --no-renames -t -z 2839944139e0de9737a044f78b0e4b40d989a9e3 -- branch1.txt file1.txt
2021/11/18 15:37:04 ...dules/git/command.go:143:RunWithContext() [D] /drone/src/modules/git/tests/repos/repo1_bare: /usr/bin/git -c credential.helper= -c protocol.version=2 log --name-status -c --format=commit%x00%H %P%x00 --parents --no-renames -t -z 2839944139e0de9737a044f78b0e4b40d989a9e3 -- branch1.txt
2021/11/18 15:37:04 ...dules/git/command.go:143:RunWithContext() [D] /drone/src/modules/git/tests/repos/repo1_bare: /usr/bin/git -c credential.helper= -c protocol.version=2 log --name-status -c --format=commit%x00%H %P%x00 --parents --no-renames -t -z 5c80b0245c1c6f8343fa418ec374b13b5d4ee658 -- branch2 branch2/branch2.txt
2021/11/18 15:37:04 ...dules/git/command.go:143:RunWithContext() [D] /drone/src/modules/git/tests/repos/repo1_bare: /usr/bin/git -c credential.helper= -c protocol.version=2 log --name-status -c --format=commit%x00%H %P%x00 --parents --no-renames -t -z feaf4ba6bc635fec442f46ddd4512416ec43c2c2 -- file1.txt file2.txt foo
2021/11/18 15:37:04 ...dules/git/command.go:143:RunWithContext() [D] /drone/src/modules/git/tests/repos/repo1_bare: /usr/bin/git -c credential.helper= -c protocol.version=2 log --name-status -c --format=commit%x00%H %P%x00 --parents --no-renames -t -z 37991dec2c8e592043f47155ce4808d4580f9123 -- file1.txt file2.txt
2021/11/18 15:37:04 ...dules/git/command.go:143:RunWithContext() [D] /drone/src/modules/git/tests/repos/repo1_bare: /usr/bin/git -c credential.helper= -c protocol.version=2 log --name-status -c --format=commit%x00%H %P%x00 --parents --no-renames -t -z 8d92fc957a4d7cfd98bc375f0b7bb189a0d6c9f2 -- file1.txt
2021/11/18 15:37:04 ...dules/git/command.go:141:RunWithContext() [D] /usr/bin/git -c credential.helper= -c protocol.version=2 clone --quiet -- tests/repos/repo1_bare tests/repos/repo1_TestEntries_GetCommitsInfo
--- FAIL: TestEntries_GetCommitsInfo (1.10s)
    commit_info_test.go:102: 
        	Error Trace:	commit_info_test.go:102
        	Error:      	Received unexpected error:
        	            	signal: segmentation fault (core dumped)
        	Test:       	TestEntries_GetCommitsInfo
    commit_info_test.go:105: 
        	Error Trace:	commit_info_test.go:105
        	Error:      	Received unexpected error:
        	            	no such file or directory
        	Test:       	TestEntries_GetCommitsInfo
panic: runtime error: invalid memory address or nil pointer dereference [recovered]
	panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0xa91e94]

goroutine 1533 [running]:
testing.tRunner.func1.2({0xc0b480, 0x1dcf0c0})
	/usr/local/go/src/testing/testing.go:1209 +0x36c
testing.tRunner.func1()
	/usr/local/go/src/testing/testing.go:1212 +0x3b6
panic({0xc0b480, 0x1dcf0c0})
	/usr/local/go/src/runtime/panic.go:1047 +0x266
code.gitea.io/gitea/modules/git.(*Repository).CatFileBatch(0x0)
	/drone/src/modules/git/repo_base_nogogit.go:59 +0x54
code.gitea.io/gitea/modules/git.(*Repository).getCommit(0xc001088480, {0x8d, 0x92, 0xfc, 0x95, 0x7a, 0x4d, 0x7c, 0xfd, 0x98, ...})
	/drone/src/modules/git/repo_commit_nogogit.go:56 +0x72
code.gitea.io/gitea/modules/git.(*Repository).GetCommit(0xc085c0, {0xdaa84f, 0x28})
	/drone/src/modules/git/repo_commit.go:34 +0x117
code.gitea.io/gitea/modules/git.testGetCommitsInfo(0xc00168f1e0, 0xc00168f1e0)
	/drone/src/modules/git/commit_info_test.go:61 +0x55c
code.gitea.io/gitea/modules/git.TestEntries_GetCommitsInfo(0x0)
	/drone/src/modules/git/commit_info_test.go:108 +0x2a9
testing.tRunner(0xc00168f1e0, 0xdc5548)
	/usr/local/go/src/testing/testing.go:1259 +0x230
created by testing.(*T).Run
	/usr/local/go/src/testing/testing.go:1306 +0x727
FAIL	code.gitea.io/gitea/modules/git	13.816s

Case 4 - Fixed by #17970

Apparent SQLite deadlock in testInsertIssue

gitea CI failure (sqlite, 20m timeout)

https://gist.github.com/wxiaoguang/bd0e1c9377f00f6a4438836e07bba048

Very long logs, sample:


goroutine 2182 [chan receive, 19 minutes, locked to thread]:
github.com/mattn/go-sqlite3.unlock_notify_wait(0x0)
	/drone/src/vendor/github.com/mattn/go-sqlite3/sqlite3_opt_unlock_notify.go:90 +0x20c
github.com/mattn/go-sqlite3._Cfunc__sqlite3_step_row_internal(0x7f5eec0087e8, 0xc00281f068, 0xc00281f078)
	_cgo_gotypes.go:374 +0x85
github.com/mattn/go-sqlite3.(*SQLiteStmt).execSync.func3(0xc003862f90, 0x5461130, 0x0)
	/drone/src/vendor/github.com/mattn/go-sqlite3/sqlite3.go:1999 +0x8d
github.com/mattn/go-sqlite3.(*SQLiteStmt).execSync(0xc003862f90, {0x5461130, 0x0, 0x0})
	/drone/src/vendor/github.com/mattn/go-sqlite3/sqlite3.go:1999 +0xc5
github.com/mattn/go-sqlite3.(*SQLiteStmt).exec(0xc003862f90, {0x3af8778, 0xc0000400f8}, {0x5461130, 0xf, 0xc0032832d8})
	/drone/src/vendor/github.com/mattn/go-sqlite3/sqlite3.go:1961 +0x52b
github.com/mattn/go-sqlite3.(*SQLiteConn).exec(0xc0028c2650, {0x3af8778, 0xc0000400f8}, {0x1cd3b35, 0xf}, {0x0, 0x0, 0x0})
	/drone/src/vendor/github.com/mattn/go-sqlite3/sqlite3.go:821 +0x26f
github.com/mattn/go-sqlite3.(*SQLiteConn).begin(0xc002c9e6c0, {0x3af8778, 0xc0000400f8})
	/drone/src/vendor/github.com/mattn/go-sqlite3/sqlite3.go:902 +0x6a
github.com/mattn/go-sqlite3.(*SQLiteConn).BeginTx(0xc003283980, {0x3af8778, 0xc0000400f8}, {0x0, 0xff})
	/drone/src/vendor/github.com/mattn/go-sqlite3/sqlite3_go18.go:51 +0x45
database/sql.ctxDriverBegin({0x3af8778, 0xc0000400f8}, 0x0, {0x3aee3d0, 0xc002c9e6c0})
	/usr/local/go/src/database/sql/ctxutil.go:104 +0x103
database/sql.(*DB).beginDC.func1()
	/usr/local/go/src/database/sql/sql.go:1845 +0x14f
database/sql.withLock({0x3aebe68, 0xc0028c2630}, 0xc0032836a0)
	/usr/local/go/src/database/sql/sql.go:3396 +0xb6
database/sql.(*DB).beginDC(0xc0017a3ee0, {0x3af8778, 0xc0000400f8}, 0xc0028c2630, 0xc002273c50, 0x0)
	/usr/local/go/src/database/sql/sql.go:1841 +0x125
database/sql.(*DB).begin(0x7f620a061d28, {0x3af8778, 0xc0000400f8}, 0x7f6233950a48, 0x80)
	/usr/local/go/src/database/sql/sql.go:1834 +0x105
database/sql.(*DB).BeginTx(0xc0016d8f60, {0x3af8778, 0xc0000400f8}, 0x3b18ee0)
	/usr/local/go/src/database/sql/sql.go:1809 +0x94
xorm.io/xorm/core.(*DB).BeginTx(0xc0016d8f60, {0x3af8778, 0xc0000400f8}, 0x5461130)
	/drone/src/vendor/xorm.io/xorm/core/tx.go:32 +0x258
xorm.io/xorm.(*Session).Begin(0xc0019951e0)
	/drone/src/vendor/xorm.io/xorm/session_tx.go:10 +0xaa
code.gitea.io/gitea/models/db.getNextResourceIndex({0x1c8a49f, 0xb}, 0x0)
	/drone/src/models/db/index.go:86 +0xd5
code.gitea.io/gitea/models/db.GetNextResourceIndex({0x1c8a49f, 0xb}, 0xc0048146c0)
	/drone/src/models/db/index.go:64 +0x65
code.gitea.io/gitea/models.NewIssue(0xc00177ca00, 0xc002359500, {0x0, 0x0, 0x0}, {0x0, 0x0, 0x0})
	/drone/src/models/issue.go:1028 +0xbe
code.gitea.io/gitea/models.testInsertIssue.func1(0x0)
	/drone/src/models/issue_test.go:366 +0x336
testing.tRunner(0xc000202340, 0xc001285540)
	/usr/local/go/src/testing/testing.go:1259 +0x230
created by testing.(*T).Run
	/usr/local/go/src/testing/testing.go:1306 +0x727

Case 5

Deadlock/Hang in TestRepoCommitsWithStatusError
=== TestRepoCommits (integrations/repo_commits_test.go:21)
=== TestRepoCommitsWithStatusPending (integrations/repo_commits_test.go:36)
=== TestRepoCommitsWithStatusSuccess (integrations/repo_commits_test.go:36)
=== TestRepoCommitsWithStatusError (integrations/repo_commits_test.go:36)
SIGABRT: abort
PC=0x4a13e1 m=0 sigcode=0

goroutine 0 [idle]:
runtime.futex()
	/usr/local/go/src/runtime/sys_linux_amd64.s:519 +0x21
runtime.futexsleep(0x7ffc235450b0, 0x43edd9, 0x1e)
	/usr/local/go/src/runtime/os_linux.go:44 +0x36
runtime.notesleep(0x6dc2a10)
	/usr/local/go/src/runtime/lock_futex.go:160 +0x87
runtime.mPark()
	/usr/local/go/src/runtime/proc.go:1441 +0x2a
runtime.stopm()
	/usr/local/go/src/runtime/proc.go:2408 +0x78
runtime.findrunnable()
	/usr/local/go/src/runtime/proc.go:2984 +0x865
runtime.schedule()
	/usr/local/go/src/runtime/proc.go:3367 +0x239
runtime.park_m(0xc0004ee4e0)
	/usr/local/go/src/runtime/proc.go:3516 +0x14d
runtime.mcall()
	/usr/local/go/src/runtime/asm_amd64.s:307 +0x43

goroutine 1 [chan receive]:
testing.(*T).Run(0xc0042224e0, {0x34e0438, 0x1e}, 0x35bfdc8)
	/usr/local/go/src/testing/testing.go:1307 +0x752
testing.runTests.func1(0x0)
	/usr/local/go/src/testing/testing.go:1598 +0x9a
testing.tRunner(0xc0042224e0, 0xc0062379c8)
	/usr/local/go/src/testing/testing.go:1259 +0x230
testing.runTests(0xc001b8f980, {0x6d705a0, 0x15b, 0x15b}, {0xc002035ff0, 0x1f0, 0x0})
	/usr/local/go/src/testing/testing.go:1596 +0x7cb
testing.(*M).Run(0xc001b8f980)
	/usr/local/go/src/testing/testing.go:1504 +0x9d2
code.gitea.io/gitea/integrations.TestMain(0x400)
	/drone/src/integrations/integration_test.go:124 +0x465
main.main()
	_testmain.go:743 +0x265

goroutine 20 [select]:
code.gitea.io/gitea/modules/log.(*MultiChannelledLog).Start(0xc000218100)
	/drone/src/modules/log/event.go:300 +0x405
created by code.gitea.io/gitea/modules/log.(*MultiChannelledLog).AddLogger
	/drone/src/modules/log/event.go:190 +0x2a6

goroutine 5 [select]:
github.com/blevesearch/bleve_index_api.AnalysisWorker({0xc001b815c0, 0xc001b81620})
	/drone/src/vendor/github.com/blevesearch/bleve_index_api/analysis.go:46 +0xc7
created by github.com/blevesearch/bleve_index_api.NewAnalysisQueue
	/drone/src/vendor/github.com/blevesearch/bleve_index_api/analysis.go:38 +0xbc

goroutine 6 [select]:
github.com/blevesearch/bleve_index_api.AnalysisWorker({0xc001b815c0, 0xc001b81620})
	/drone/src/vendor/github.com/blevesearch/bleve_index_api/analysis.go:46 +0xc7
created by github.com/blevesearch/bleve_index_api.NewAnalysisQueue
	/drone/src/vendor/github.com/blevesearch/bleve_index_api/analysis.go:38 +0xbc

goroutine 7 [select]:
github.com/blevesearch/bleve_index_api.AnalysisWorker({0xc001b815c0, 0xc001b81620})
	/drone/src/vendor/github.com/blevesearch/bleve_index_api/analysis.go:46 +0xc7
created by github.com/blevesearch/bleve_index_api.NewAnalysisQueue
	/drone/src/vendor/github.com/blevesearch/bleve_index_api/analysis.go:38 +0xbc

goroutine 8 [select]:
github.com/blevesearch/bleve_index_api.AnalysisWorker({0xc001b815c0, 0xc001b81620})
	/drone/src/vendor/github.com/blevesearch/bleve_index_api/analysis.go:46 +0xc7
created by github.com/blevesearch/bleve_index_api.NewAnalysisQueue
	/drone/src/vendor/github.com/blevesearch/bleve_index_api/analysis.go:38 +0xbc

goroutine 10 [select, 34 minutes]:
code.gitea.io/gitea/modules/graceful.(*Manager).handleSignals(0x4733da, {0x54a4730, 0xc001f7fdc0})
	/drone/src/modules/graceful/manager_unix.go:118 +0x211
created by code.gitea.io/gitea/modules/graceful.(*Manager).start
	/drone/src/modules/graceful/manager_unix.go:65 +0x3f1

goroutine 11 [semacquire, 34 minutes]:
sync.runtime_Semacquire(0xc00154f434)
	/usr/local/go/src/runtime/sema.go:56 +0x25
sync.(*WaitGroup).Wait(0xc00154f434)
	/usr/local/go/src/sync/waitgroup.go:130 +0xea
code.gitea.io/gitea/modules/graceful.(*Manager).start.func1()
	/drone/src/modules/graceful/manager_unix.go:73 +0x86
created by code.gitea.io/gitea/modules/graceful.(*Manager).start
	/drone/src/modules/graceful/manager_unix.go:69 +0x4b3

goroutine 72 [syscall, 34 minutes]:
os/signal.signal_recv()
	/usr/local/go/src/runtime/sigqueue.go:169 +0x98
os/signal.loop()
	/usr/local/go/src/os/signal/signal_unix.go:24 +0x25
created by os/signal.Notify.func1.1
	/usr/local/go/src/os/signal/signal.go:151 +0x53

goroutine 388 [select]:
github.com/blevesearch/bleve/v2/index/scorch.(*Scorch).mergerLoop(0xc000601400)
	/drone/src/vendor/github.com/blevesearch/bleve/v2/index/scorch/merge.go:123 +0x95b
created by github.com/blevesearch/bleve/v2/index/scorch.(*Scorch).Open
	/drone/src/vendor/github.com/blevesearch/bleve/v2/index/scorch/scorch.go:186 +0x205

goroutine 92 [select]:
github.com/blevesearch/bleve/v2/index/scorch.(*Scorch).introducerLoop(0xc00061e800)
	/drone/src/vendor/github.com/blevesearch/bleve/v2/index/scorch/introducer.go:54 +0x28c
created by github.com/blevesearch/bleve/v2/index/scorch.(*Scorch).Open
	/drone/src/vendor/github.com/blevesearch/bleve/v2/index/scorch/scorch.go:180 +0xc5

goroutine 387 [select]:
github.com/blevesearch/bleve/v2/index/scorch.(*Scorch).persisterLoop(0xc000601400)
	/drone/src/vendor/github.com/blevesearch/bleve/v2/index/scorch/persister.go:215 +0x11a9
created by github.com/blevesearch/bleve/v2/index/scorch.(*Scorch).Open
	/drone/src/vendor/github.com/blevesearch/bleve/v2/index/scorch/scorch.go:184 +0x185

goroutine 386 [select]:
github.com/blevesearch/bleve/v2/index/scorch.(*Scorch).introducerLoop(0xc000601400)
	/drone/src/vendor/github.com/blevesearch/bleve/v2/index/scorch/introducer.go:54 +0x28c
created by github.com/blevesearch/bleve/v2/index/scorch.(*Scorch).Open
	/drone/src/vendor/github.com/blevesearch/bleve/v2/index/scorch/scorch.go:180 +0xc5

goroutine 80 [select, 34 minutes]:
database/sql.(*DB).connectionOpener(0xc0020c3040, {0x54a4730, 0xc002130500})
	/usr/local/go/src/database/sql/sql.go:1196 +0xfa
created by database/sql.OpenDB
	/usr/local/go/src/database/sql/sql.go:794 +0x307

goroutine 215 [select, 4 minutes]:
github.com/gogs/cron.(*Cron).run(0xc00010e870)
	/drone/src/vendor/github.com/gogs/cron/cron.go:197 +0xa0f
created by github.com/gogs/cron.(*Cron).Start
	/drone/src/vendor/github.com/gogs/cron/cron.go:150 +0xc5

goroutine 13 [select]:
code.gitea.io/gitea/modules/log.(*ChannelledLog).Start(0xc0020381e0)
	/drone/src/modules/log/event.go:70 +0x137
created by code.gitea.io/gitea/modules/log.NewChannelledLog
	/drone/src/modules/log/event.go:61 +0x425

goroutine 163 [select]:
code.gitea.io/gitea/modules/log.(*MultiChannelledLog).Start(0xc003e9ff00)
	/drone/src/modules/log/event.go:300 +0x405
created by code.gitea.io/gitea/modules/log.(*MultiChannelledLog).AddLogger
	/drone/src/modules/log/event.go:190 +0x2a6

goroutine 162 [select]:
code.gitea.io/gitea/modules/log.(*ChannelledLog).Start(0xc002038550)
	/drone/src/modules/log/event.go:70 +0x137
created by code.gitea.io/gitea/modules/log.NewChannelledLog
	/drone/src/modules/log/event.go:61 +0x425

goroutine 93 [select]:
github.com/blevesearch/bleve/v2/index/scorch.(*Scorch).persisterLoop(0xc00061e800)
	/drone/src/vendor/github.com/blevesearch/bleve/v2/index/scorch/persister.go:215 +0x11a9
created by github.com/blevesearch/bleve/v2/index/scorch.(*Scorch).Open
	/drone/src/vendor/github.com/blevesearch/bleve/v2/index/scorch/scorch.go:184 +0x185

goroutine 15 [select]:
code.gitea.io/gitea/modules/log.(*ChannelledLog).Start(0xc002038320)
	/drone/src/modules/log/event.go:70 +0x137
created by code.gitea.io/gitea/modules/log.NewChannelledLog
	/drone/src/modules/log/event.go:61 +0x425

goroutine 223 [select]:
code.gitea.io/gitea/services/webhook.DeliverHooks({0x54a4730, 0xc001f7fe40})
	/drone/src/services/webhook/deliver.go:230 +0x392
code.gitea.io/gitea/modules/graceful.(*Manager).RunWithShutdownContext(0xc00154f3b0, 0x35c2728)
	/drone/src/modules/graceful/manager.go:139 +0x12d
created by code.gitea.io/gitea/services/webhook.InitDeliverHooks
	/drone/src/services/webhook/deliver.go:325 +0x425

goroutine 307 [select, 21 minutes]:
code.gitea.io/gitea/modules/eventsource.(*Manager).Run(0xc001b8d980, {0x54a4730, 0xc001f7fe40})
	/drone/src/modules/eventsource/manager_run.go:51 +0x2f9
code.gitea.io/gitea/modules/graceful.(*Manager).RunWithShutdownContext(0xc00154f3b0, 0xc0014a5090)
	/drone/src/modules/graceful/manager.go:139 +0x12d
created by code.gitea.io/gitea/modules/eventsource.(*Manager).Init
	/drone/src/modules/eventsource/manager_run.go:23 +0x17d

goroutine 94 [select]:
github.com/blevesearch/bleve/v2/index/scorch.(*Scorch).mergerLoop(0xc00061e800)
	/drone/src/vendor/github.com/blevesearch/bleve/v2/index/scorch/merge.go:123 +0x95b
created by github.com/blevesearch/bleve/v2/index/scorch.(*Scorch).Open
	/drone/src/vendor/github.com/blevesearch/bleve/v2/index/scorch/scorch.go:186 +0x205

goroutine 97 [select, 33 minutes]:
code.gitea.io/gitea/modules/graceful.(*Server).awaitShutdown(0x0)
	/drone/src/modules/graceful/server_hooks.go:16 +0x15a
created by code.gitea.io/gitea/modules/graceful.(*Server).ListenAndServe
	/drone/src/modules/graceful/server.go:83 +0xc8

goroutine 372 [IO wait, 16 minutes]:
internal/poll.runtime_pollWait(0x7f51127ca758, 0x72)
	/usr/local/go/src/runtime/netpoll.go:234 +0x89
internal/poll.(*pollDesc).wait(0xc004194a98, 0x473701, 0x0)
	/usr/local/go/src/internal/poll/fd_poll_runtime.go:84 +0xbd
internal/poll.(*pollDesc).waitRead(...)
	/usr/local/go/src/internal/poll/fd_poll_runtime.go:89
internal/poll.(*FD).Accept(0xc004194a80)
	/usr/local/go/src/internal/poll/fd_unix.go:402 +0x425
net.(*netFD).accept(0xc004194a80)
	/usr/local/go/src/net/fd_unix.go:173 +0x4a
net.(*TCPListener).accept(0xc0042af128)
	/usr/local/go/src/net/tcpsock_posix.go:140 +0x45
net.(*TCPListener).AcceptTCP(0xc0042af128)
	/usr/local/go/src/net/tcpsock.go:249 +0x66
code.gitea.io/gitea/modules/graceful.(*wrappedListener).Accept(0xc001bb96a0)
	/drone/src/modules/graceful/server.go:214 +0x74
github.com/gliderlabs/ssh.(*Server).Serve(0xc0020205a0, {0x5489b48, 0xc001bb96a0})
	/drone/src/vendor/github.com/gliderlabs/ssh/server.go:237 +0x2e5
code.gitea.io/gitea/modules/graceful.(*Server).Serve(0xc003fcc460, 0xc0005d3fa0)
	/drone/src/modules/graceful/server.go:167 +0x18d
code.gitea.io/gitea/modules/graceful.(*Server).ListenAndServe(0xc003fcc460, 0x1)
	/drone/src/modules/graceful/server.go:95 +0x3a8
code.gitea.io/gitea/modules/ssh.listen(0xc0020205a0)
	/drone/src/modules/ssh/ssh_graceful.go:20 +0x11c
created by code.gitea.io/gitea/modules/ssh.Listen
	/drone/src/modules/ssh/ssh.go:344 +0xa48

goroutine 133809 [IO wait]:
internal/poll.runtime_pollWait(0x7f51115b5e50, 0x72)
	/usr/local/go/src/runtime/netpoll.go:234 +0x89
internal/poll.(*pollDesc).wait(0xc0063c0898, 0xc0084de000, 0x0)
	/usr/local/go/src/internal/poll/fd_poll_runtime.go:84 +0xbd
internal/poll.(*pollDesc).waitRead(...)
	/usr/local/go/src/internal/poll/fd_poll_runtime.go:89
internal/poll.(*FD).Read(0xc0063c0880, {0xc0084de000, 0x1000, 0x1000})
	/usr/local/go/src/internal/poll/fd_unix.go:167 +0x419
net.(*netFD).Read(0xc0063c0880, {0xc0084de000, 0x1000, 0x1000})
	/usr/local/go/src/net/fd_posix.go:56 +0x51
net.(*conn).Read(0xc008f307e8, {0xc0084de000, 0x1000, 0x1000})
	/usr/local/go/src/net/net.go:183 +0xb1
github.com/go-sql-driver/mysql.(*buffer).fill(0xc005b4eb40, 0x4)
	/drone/src/vendor/github.com/go-sql-driver/mysql/buffer.go:90 +0x423
github.com/go-sql-driver/mysql.(*buffer).readNext(0xc005b4eb40, 0x4)
	/drone/src/vendor/github.com/go-sql-driver/mysql/buffer.go:119 +0x5a
github.com/go-sql-driver/mysql.(*mysqlConn).readPacket(0xc005b4eb40)
	/drone/src/vendor/github.com/go-sql-driver/mysql/packets.go:32 +0xaf
github.com/go-sql-driver/mysql.(*mysqlConn).readResultSetHeaderPacket(0xc008751ed8)
	/drone/src/vendor/github.com/go-sql-driver/mysql/packets.go:538 +0x31
github.com/go-sql-driver/mysql.(*mysqlStmt).query(0xc008751ed8, {0xc00fa5b210, 0x1, 0x1})
	/drone/src/vendor/github.com/go-sql-driver/mysql/statement.go:114 +0x2cd
github.com/go-sql-driver/mysql.(*mysqlStmt).QueryContext(0xc008751ed8, {0x54a4730, 0xc001f7fe80}, {0xc006fceae0, 0x1, 0x1})
	/drone/src/vendor/github.com/go-sql-driver/mysql/connection.go:558 +0xf1
database/sql.ctxDriverStmtQuery({0x54a4730, 0xc001f7fe80}, {0x54a4b58, 0xc008751ed8}, {0xc006fceae0, 0x1, 0x1})
	/usr/local/go/src/database/sql/ctxutil.go:82 +0x1d5
database/sql.rowsiFromStatement({0x54a4730, 0xc001f7fe80}, {0x548a7d8, 0xc005b4eb40}, 0xc004ea4d40, {0xc0088da6e0, 0x1, 0x1})
	/usr/local/go/src/database/sql/sql.go:2794 +0x217
database/sql.(*DB).queryDC(0xc001f7fe01, {0x54a4730, 0xc001f7fe80}, {0x0, 0x0}, 0xc004793c20, 0xc0088da700, {0xc00862c500, 0x271}, {0xc0088da6e0, ...})
	/usr/local/go/src/database/sql/sql.go:1752 +0x4f8
database/sql.(*DB).query(0x80, {0x54a4730, 0xc001f7fe80}, {0xc00862c500, 0x271}, {0xc0088da6e0, 0x1, 0x1}, 0x0)
	/usr/local/go/src/database/sql/sql.go:1700 +0x177
database/sql.(*DB).QueryContext(0xc00224aba0, {0x54a4730, 0xc001f7fe80}, {0xc00862c500, 0x271}, {0xc0088da6e0, 0x1, 0x1})
	/usr/local/go/src/database/sql/sql.go:1674 +0xfa
xorm.io/xorm/core.(*DB).QueryContext(0xc00224aba0, {0x54a4730, 0xc001f7fe80}, {0xc00862c500, 0x271}, {0xc0088da6e0, 0x1, 0x1})
	/drone/src/vendor/xorm.io/xorm/core/db.go:151 +0x2bc
xorm.io/xorm.(*Session).queryRows(0xc008627110, {0xc00862c500, 0x271}, {0xc0088da6e0, 0x43a0e5, 0x447779})
	/drone/src/vendor/xorm.io/xorm/session_raw.go:56 +0x5eb
xorm.io/xorm.(*Session).nocacheGet(0xc00541a750, 0x19, 0x0, {0x3302360, 0xc004666e00}, {0xc00862c500, 0x271}, {0xc0088da6e0, 0x1, 0x1})
	/drone/src/vendor/xorm.io/xorm/session_get.go:155 +0xb9
xorm.io/xorm.(*Session).get(0xc008627110, {0x3302360, 0xc004666e00})
	/drone/src/vendor/xorm.io/xorm/session_get.go:117 +0xdca
xorm.io/xorm.(*Session).Get(0xc008627110, {0x3302360, 0xc004666e00})
	/drone/src/vendor/xorm.io/xorm/session_get.go:35 +0xd7
code.gitea.io/gitea/models.getRepositoryByID({0x54fbd50, 0xc0020db860}, 0x1)
	/drone/src/models/repo.go:1731 +0x8f
code.gitea.io/gitea/models.(*Issue).loadRepo(0xc007efec00, {0x54fbd50, 0xc0020db860})
	/drone/src/models/issue.go:123 +0x9a
code.gitea.io/gitea/models.(*Issue).LoadRepo(0x32b24c0)
	/drone/src/models/issue.go:118 +0x55
code.gitea.io/gitea/routers/web/repo.GetActiveStopwatch(0xc008d50e40)
	/drone/src/routers/web/repo/issue_stopwatch.go:91 +0x1c9
code.gitea.io/gitea/modules/web.Middle.func1.1({0x30767a0, 0x315dbc0}, 0xc005ee7d00)
	/drone/src/modules/web/route.go:109 +0x10e
net/http.HandlerFunc.ServeHTTP(0xc006fc9fc0, {0x5489ab8, 0xc005159f40}, 0x446800)
	/usr/local/go/src/net/http/server.go:2046 +0x4e
code.gitea.io/gitea/modules/web.Middle.func1.1({0xc005c061b0, 0x4a0619}, 0xc005ee7d00)
	/drone/src/modules/web/route.go:113 +0x1ab
net/http.HandlerFunc.ServeHTTP(0xc006fc9fe0, {0x5489ab8, 0xc005159f40}, 0x0)
	/usr/local/go/src/net/http/server.go:2046 +0x4e
github.com/go-chi/chi/middleware.GetHead.func1({0x5489ab8, 0xc005159f40}, 0xc005ee7d00)
	/drone/src/vendor/github.com/go-chi/chi/middleware/get_head.go:37 +0x3cc
net/http.HandlerFunc.ServeHTTP(0xc0088ae6a8, {0x5489ab8, 0xc005159f40}, 0xc005c061b0)
	/usr/local/go/src/net/http/server.go:2046 +0x4e
code.gitea.io/gitea/modules/web.Middle.func1.1({0x30767a0, 0x315dbc0}, 0xc005ee7d00)
	/drone/src/modules/web/route.go:113 +0x1ab
net/http.HandlerFunc.ServeHTTP(0xc007480000, {0x5489ab8, 0xc005159f40}, 0x8)
	/usr/local/go/src/net/http/server.go:2046 +0x4e
code.gitea.io/gitea/modules/context.Contexter.func1.1({0x5489ab8, 0xc005159f40}, 0xc005ee7b00)
	/drone/src/modules/context/context.go:763 +0x2b7a
net/http.HandlerFunc.ServeHTTP(0xc006ffd050, {0x5489ab8, 0xc005159f40}, 0x48695c)
	/usr/local/go/src/net/http/server.go:2046 +0x4e
github.com/go-chi/chi/v5.(*Mux).ServeHTTP(0xc006ff5920, {0x5489ab8, 0xc005159f40}, 0xc005ee7b00)
	/drone/src/vendor/github.com/go-chi/chi/v5/mux.go:71 +0x937
github.com/go-chi/chi/v5.(*Mux).Mount.func1({0x5489ab8, 0xc005159f40}, 0xc005ee7b00)
	/drone/src/vendor/github.com/go-chi/chi/v5/mux.go:314 +0x516
net/http.HandlerFunc.ServeHTTP(0xc0074dca00, {0x5489ab8, 0xc005159f40}, 0xc00f218cf0)
	/usr/local/go/src/net/http/server.go:2046 +0x4e
github.com/go-chi/chi/v5.(*Mux).routeHTTP(0xc0069456e0, {0x5489ab8, 0xc005159f40}, 0xc005ee7b00)
	/drone/src/vendor/github.com/go-chi/chi/v5/mux.go:442 +0x498
net/http.HandlerFunc.ServeHTTP(0xc000e2c280, {0x5489ab8, 0xc005159f40}, 0x7f511210f368)
	/usr/local/go/src/net/http/server.go:2046 +0x4e
code.gitea.io/gitea/routers/web.Recovery.func1.1({0x5489ab8, 0xc005159f40}, 0xc005ee7b00)
	/drone/src/routers/web/base.go:169 +0x127
net/http.HandlerFunc.ServeHTTP(0xc006245440, {0x5489ab8, 0xc005159f40}, 0x543c680)
	/usr/local/go/src/net/http/server.go:2046 +0x4e
gitea.com/go-chi/session.Sessioner.func1.1({0x5489ab8, 0xc005159f40}, 0xc005ee7a00)
	/drone/src/vendor/gitea.com/go-chi/session/session.go:257 +0x4dc
net/http.HandlerFunc.ServeHTTP(0xc006245480, {0x5489ab8, 0xc005159f40}, 0x1)
	/usr/local/go/src/net/http/server.go:2046 +0x4e
code.gitea.io/gitea/modules/public.AssetsHandler.func1.1({0x5489ab8, 0xc005159f40}, 0xc005ee7a00)
	/drone/src/modules/public/public.go:42 +0x154
net/http.HandlerFunc.ServeHTTP(0xc0022b3380, {0x5489ab8, 0xc005159f40}, 0x48695c)
	/usr/local/go/src/net/http/server.go:2046 +0x4e
github.com/go-chi/chi/v5.(*Mux).ServeHTTP(0xc0069456e0, {0x5489ab8, 0xc005159f40}, 0xc005ee7a00)
	/drone/src/vendor/github.com/go-chi/chi/v5/mux.go:71 +0x937
github.com/go-chi/chi/v5.(*Mux).Mount.func1({0x5489ab8, 0xc005159f40}, 0xc005ee7a00)
	/drone/src/vendor/github.com/go-chi/chi/v5/mux.go:314 +0x516
net/http.HandlerFunc.ServeHTTP(0xc0074dca20, {0x5489ab8, 0xc005159f40}, 0x34fb423)
	/usr/local/go/src/net/http/server.go:2046 +0x4e
github.com/go-chi/chi/v5.(*Mux).routeHTTP(0xc0069455c0, {0x5489ab8, 0xc005159f40}, 0xc005ee7a00)
	/drone/src/vendor/github.com/go-chi/chi/v5/mux.go:442 +0x498
net/http.HandlerFunc.ServeHTTP(0xc00a1efa20, {0x5489ab8, 0xc005159f40}, 0xc0001ec960)
	/usr/local/go/src/net/http/server.go:2046 +0x4e
code.gitea.io/gitea/routers/common.Middlewares.func2.1({0x5489ab8, 0xc005159f40}, 0x0)
	/drone/src/routers/common/middleware.go:72 +0xf1
net/http.HandlerFunc.ServeHTTP(0xc00ccd2f78, {0x5489ab8, 0xc005159f40}, 0x3472b82)
	/usr/local/go/src/net/http/server.go:2046 +0x4e
code.gitea.io/gitea/routers/common.LoggerHandler.func1.1({0x5489ab8, 0xc005159f40}, 0xc005ee7a00)
	/drone/src/routers/common/logger.go:23 +0x6d9
net/http.HandlerFunc.ServeHTTP(0xc0074dca40, {0x5489ab8, 0xc005159f40}, 0x4a0619)
	/usr/local/go/src/net/http/server.go:2046 +0x4e
github.com/go-chi/chi/middleware.StripSlashes.func1({0x5489ab8, 0xc005159f40}, 0xc005ee7a00)
	/drone/src/vendor/github.com/go-chi/chi/middleware/strip.go:30 +0x279
net/http.HandlerFunc.ServeHTTP(0xc00ccd2f90, {0x5489ab8, 0xc005159f40}, 0x0)
	/usr/local/go/src/net/http/server.go:2046 +0x4e
github.com/chi-middleware/proxy.ForwardedHeaders.func1.1({0x5489ab8, 0xc005159f40}, 0xc005ee7a00)
	/drone/src/vendor/github.com/chi-middleware/proxy/middleware.go:37 +0x251
net/http.HandlerFunc.ServeHTTP(0xc0074dca60, {0x5489ab8, 0xc005159f40}, 0x88)
	/usr/local/go/src/net/http/server.go:2046 +0x4e
code.gitea.io/gitea/routers/common.Middlewares.func1.1({0x548bb28, 0xc005159f00}, 0xc004793e60)
	/drone/src/routers/common/middleware.go:25 +0x179
net/http.HandlerFunc.ServeHTTP(0xc00ccd2ff0, {0x548bb28, 0xc005159f00}, 0x6d283f0)
	/usr/local/go/src/net/http/server.go:2046 +0x4e
github.com/go-chi/chi/v5.(*Mux).ServeHTTP(0xc0069455c0, {0x548bb28, 0xc005159f00}, 0xc005ee7900)
	/drone/src/vendor/github.com/go-chi/chi/v5/mux.go:88 +0x8b7
code.gitea.io/gitea/modules/web.(*Route).ServeHTTP(...)
	/drone/src/modules/web/route.go:328
code.gitea.io/gitea/integrations.MakeRequest({0x54f2db0, 0xc010f109c0}, 0xc005ee7900, 0xc8)
	/drone/src/integrations/integration_test.go:450 +0x1d5
code.gitea.io/gitea/integrations.(*TestSession).MakeRequest(0xc0062233c0, {0x54f2db0, 0xc010f109c0}, 0x3, 0x34fb423)
	/drone/src/integrations/integration_test.go:285 +0x18d
code.gitea.io/gitea/integrations.doTestRepoCommitWithStatus(0x61974e42, {0x333f415, 0x5}, {0xc008be9e68, 0x2, 0xc0005c7e78})
	/drone/src/integrations/repo_commits_test.go:43 +0x135
code.gitea.io/gitea/integrations.TestRepoCommitsWithStatusError(0x0)
	/drone/src/integrations/repo_commits_test.go:117 +0x85
testing.tRunner(0xc010f109c0, 0x35bfdc8)
	/usr/local/go/src/testing/testing.go:1259 +0x230
created by testing.(*T).Run
	/usr/local/go/src/testing/testing.go:1306 +0x727

goroutine 47838 [select]:
code.gitea.io/gitea/modules/log.(*ChannelledLog).Start(0xc00c63f590)
	/drone/src/modules/log/event.go:70 +0x137
created by code.gitea.io/gitea/modules/log.NewChannelledLog
	/drone/src/modules/log/event.go:61 +0x425

goroutine 80726 [select]:
database/sql.(*DB).connectionCleaner(0xc0020c3040, 0xb2d05e00)
	/usr/local/go/src/database/sql/sql.go:1068 +0x14c
created by database/sql.(*DB).startCleanerLocked
	/usr/local/go/src/database/sql/sql.go:1055 +0x271

goroutine 133897 [runnable]:
github.com/go-sql-driver/mysql.(*mysqlConn).startWatcher.func1()
	/drone/src/vendor/github.com/go-sql-driver/mysql/connection.go:620 +0x212
created by github.com/go-sql-driver/mysql.(*mysqlConn).startWatcher
	/drone/src/vendor/github.com/go-sql-driver/mysql/connection.go:611 +0x1b9

rax    0xca
rbx    0x0
rcx    0x4a13e3
rdx    0x0
rdi    0x6dc2a10
rsi    0x80
rbp    0x7ffc23545058
rsp    0x7ffc23545010
r8     0x0
r9     0x0
r10    0x0
r11    0x286
r12    0x0
r13    0x32
r14    0x6dc2340
r15    0x1
rip    0x4a13e1
rflags 0x286
cs     0x33
fs     0x0
gs     0x0
timeout: the monitored command dumped core

Case 6 - FIXED by #18444

make test-backend has changed files in the source tree

unit-test

+ make unit-test-coverage test-check
ok  	code.gitea.io/gitea/services/pull	0.899s	coverage: 0.5% of statements
ok  	code.gitea.io/gitea/services/release	12.555s	coverage: 55.6% of statements
ok  	code.gitea.io/gitea/services/repository	0.873s	coverage: 9.5% of statements
ok  	code.gitea.io/gitea/services/webhook	0.601s	coverage: 65.9% of statements
ok  	code.gitea.io/gitea/services/wiki	8.059s	coverage: 67.1% of statements

==> Ok

Running test-check...
make test-backend has changed files in the source tree:
?? modules/git/tests/repos/repo1_TestGetFormatPatch/
You should change the tests to create these files in a temporary directory.
Do not simply add these files to .gitignore
make: *** [Makefile:372: test-check] Error 1
@singuliere
Copy link
Contributor

After adding -cpu=1 to unit-test-coverage I did not exprience any random failure when running drone exec --pipeline testing-amd64 .drone.yml locally on my laptop.

zeripath added a commit to zeripath/gitea that referenced this issue Jan 29, 2022
…e/MergePR

One of the repeated intermittent failures we see in testing is a failure due to
branches not being ready to merge.

Prior to the immediate queue implementation we would attempt to flush all the queues
and this would prevent the issue. However, the immediate queue is not flushable so
the flushall is not successful at preventing this.

This PR proposes an alternative solution - wait some time and try again up to 5 times.

If this fails then there is a genuine issue and we should fail.

Related go-gitea#17719

Signed-off-by: Andrew Thornton <art27@cantab.net>
@zeripath
Copy link
Contributor

zeripath commented Jan 29, 2022

OK Cases 4 & 6 are fixed.

Case 3 is likely fixed.

Case 2 - This is a race between the pr patch queue and the test. We attempt to merge and then reattempt after flushing but I think the queues are not flushable since we moved to immediate queues. - I guess we could add a timer? #18451 should fix this.

Case 1 - I have no idea what is happening there.

Case 5... This looks like a deadlock or problem with the MySQL db - the SIGABORT suggests that something has called for everything to die. Now it could be that there was a problem with MySQL container.

zeripath added a commit that referenced this issue Jan 29, 2022
…e/MergePR (#18451)

One of the repeated intermittent failures we see in testing is a failure due to
branches not being ready to merge.

Prior to the immediate queue implementation we would attempt to flush all the queues
and this would prevent the issue. However, the immediate queue is not flushable so
the flushall is not successful at preventing this.

This PR proposes an alternative solution - wait some time and try again up to 5 times.

If this fails then there is a genuine issue and we should fail.

Related #17719

Signed-off-by: Andrew Thornton <art27@cantab.net>
zeripath added a commit to zeripath/gitea that referenced this issue Feb 5, 2022
…e/MergePR (go-gitea#18451)

Backport go-gitea#18451

One of the repeated intermittent failures we see in testing is a failure due to
branches not being ready to merge.

Prior to the immediate queue implementation we would attempt to flush all the queues
and this would prevent the issue. However, the immediate queue is not flushable so
the flushall is not successful at preventing this.

This PR proposes an alternative solution - wait some time and try again up to 5 times.

If this fails then there is a genuine issue and we should fail.

Related go-gitea#17719

Signed-off-by: Andrew Thornton <art27@cantab.net>
zeripath added a commit that referenced this issue Feb 5, 2022
…e/MergePR (#18451) (#18619)

Backport #18451

One of the repeated intermittent failures we see in testing is a failure due to
branches not being ready to merge.

Prior to the immediate queue implementation we would attempt to flush all the queues
and this would prevent the issue. However, the immediate queue is not flushable so
the flushall is not successful at preventing this.

This PR proposes an alternative solution - wait some time and try again up to 5 times.

If this fails then there is a genuine issue and we should fail.

Related #17719

Signed-off-by: Andrew Thornton <art27@cantab.net>
@wxiaoguang
Copy link
Contributor Author

outdated, close this one

Chianina pushed a commit to Chianina/gitea that referenced this issue Mar 28, 2022
…e/MergePR (go-gitea#18451)

One of the repeated intermittent failures we see in testing is a failure due to
branches not being ready to merge.

Prior to the immediate queue implementation we would attempt to flush all the queues
and this would prevent the issue. However, the immediate queue is not flushable so
the flushall is not successful at preventing this.

This PR proposes an alternative solution - wait some time and try again up to 5 times.

If this fails then there is a genuine issue and we should fail.

Related go-gitea#17719

Signed-off-by: Andrew Thornton <art27@cantab.net>
@go-gitea go-gitea locked and limited conversation to collaborators Apr 28, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants