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

Bug: Api: ListPullRequests [500] #10639

Closed
6543 opened this issue Mar 6, 2020 · 7 comments · Fixed by #10676
Closed

Bug: Api: ListPullRequests [500] #10639

6543 opened this issue Mar 6, 2020 · 7 comments · Fixed by #10676
Labels
Milestone

Comments

@6543
Copy link
Member

6543 commented Mar 6, 2020

curl -X GET "https://gitea.com/api/v1/repos/gitea/tea/pulls?state=closed&milestone=538&page=1" -H "accept: application/json"

since no trace or debug info is shown and I cant reproduce on my test instance I cant veryfy or determine the reason :/

@6543
Copy link
Member Author

6543 commented Mar 6, 2020

current version of gitea.com: 1.12.0+dev-435-g6a57364dc

@noerw
Copy link
Member

noerw commented Mar 6, 2020

I can narrow the bug conditions:

This only occurs when the repo has a (closed?) PR, whose head branch has been deleted.

Can reproduce on current try.gitea.io and on gitea.com

@6543
Copy link
Member Author

6543 commented Mar 7, 2020

@lunny can this be introduced by #10413?

@guillep2k
Copy link
Member

Maybe #10618 is related?

@zeripath
Copy link
Contributor

zeripath commented Mar 8, 2020

@guillep2k that code doesn't run on the API - but perhaps a similar fix is needed for API.

@noerw are you able to give us a minimal testcase to reproduce?

@zeripath
Copy link
Contributor

zeripath commented Mar 8, 2020

OK curl -X GET "https://gitea.com/api/v1/repos/gitea/tea/pulls/106" -H "accept: application/json" also gives a 500

@zeripath
Copy link
Contributor

zeripath commented Mar 8, 2020

Replicated

2020/03/08 21:32:26 ...les/context/panic.go:35:1() [E] PANIC:: runtime error: invalid memory address or nil pointer dereference
	/usr/local/go/src/runtime/panic.go:199 (0x44c73b)
		panicmem: panic(memoryError)
	/usr/local/go/src/runtime/signal_unix.go:394 (0x44c578)
		sigpanic: panicmem()
	/home/andrew/src/go/gitea/modules/convert/pull.go:117 (0x15f8111)
		ToAPIPullRequest: log.Error("GetCommit[%s]: %v", headBranch.Name, err)
	/home/andrew/src/go/gitea/routers/api/v1/repo/pull.go:167 (0x17bd1f4)
		GetPullRequest: ctx.JSON(http.StatusOK, convert.ToAPIPullRequest(pr))

and

2020/03/08 21:33:14 ...les/context/panic.go:35:1() [E] PANIC:: runtime error: invalid memory address or nil pointer dereference
	/usr/local/go/src/runtime/panic.go:199 (0x44c73b)
		panicmem: panic(memoryError)
	/usr/local/go/src/runtime/signal_unix.go:394 (0x44c578)
		sigpanic: panicmem()
	/home/andrew/src/go/gitea/modules/convert/pull.go:117 (0x15f8111)
		ToAPIPullRequest: log.Error("GetCommit[%s]: %v", headBranch.Name, err)
	/home/andrew/src/go/gitea/routers/api/v1/repo/pull.go:112 (0x17bcdc6)
		ListPullRequests: apiPrs[i] = convert.ToAPIPullRequest(prs[i])
	/usr/local/go/src/reflect/value.go:460 (0x497885)
		Value.call: call(frametype, fn, args, uint32(frametype.size), uint32(retOffset))
	/usr/local/go/src/reflect/value.go:321 (0x497043)
		Value.Call: return v.call("Call", in)
	/home/andrew/src/go/gitea/vendor/gitea.com/macaron/inject/inject.go:177 (0xfd04e9)
		(*injector).callInvoke: return reflect.ValueOf(f).Call(in), nil
	/home/andrew/src/go/gitea/vendor/gitea.com/macaron/inject/inject.go:137 (0xfcfe99)
		(*injector).Invoke: return inj.callInvoke(f, t, t.NumIn())
	/home/andrew/src/go/gitea/vendor/gitea.com/macaron/macaron/context.go:121 (0xfd1488)
		(*Context).run: vals, err := c.Invoke(c.handler())

@lafriks lafriks added this to the 1.11.4 milestone Mar 22, 2020
@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
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants