Bug: Api: ListPullRequests [500] #5010

Closed
opened 2025-11-02 06:10:52 -06:00 by GiteaMirror · 7 comments
Owner

Originally created by @6543 on GitHub (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 :/

Originally created by @6543 on GitHub (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 :/
GiteaMirror added the type/bug label 2025-11-02 06:10:52 -06:00
Author
Owner

@6543 commented on GitHub (Mar 6, 2020):

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

@6543 commented on GitHub (Mar 6, 2020): current version of gitea.com: 1.12.0+dev-435-g6a57364dc
Author
Owner

@noerw commented on GitHub (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

@noerw commented on GitHub (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
Author
Owner

@6543 commented on GitHub (Mar 7, 2020):

@lunny can this be introduced by #10413?

@6543 commented on GitHub (Mar 7, 2020): @lunny can this be introduced by #10413?
Author
Owner

@guillep2k commented on GitHub (Mar 7, 2020):

Maybe #10618 is related?

@guillep2k commented on GitHub (Mar 7, 2020): Maybe #10618 is related?
Author
Owner

@zeripath commented on GitHub (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 commented on GitHub (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?
Author
Owner

@zeripath commented on GitHub (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 commented on GitHub (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
Author
Owner

@zeripath commented on GitHub (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())
@zeripath commented on GitHub (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()) ```
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#5010