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

If not sign in compare will return error 500 #11423

Closed
1 of 7 tasks
L0veSunshine opened this issue May 15, 2020 · 5 comments · Fixed by #11424
Closed
1 of 7 tasks

If not sign in compare will return error 500 #11423

L0veSunshine opened this issue May 15, 2020 · 5 comments · Fixed by #11424

Comments

@L0veSunshine
Copy link
Contributor

Description

When you don't sign in and click the compare button on repo's homepage, it will occur error 500

Screenshots

@zeripath
Copy link
Contributor

Logs would have been helpful.

@L0veSunshine
Copy link
Contributor Author

Logs would have been helpful.

please wait a minute and i have locate the question.
maybe is here

if baseRepo.OwnerID != ctx.User.ID {

@L0veSunshine
Copy link
Contributor Author

Here is the log

2020/05/14 12:57:18 ...les/context/panic.go:35:1() [E] PANIC:: runtime error: invalid memory address or nil pointer dereference
/home/go/src/runtime/panic.go:212 (0x456c19)
panicmem: panic(memoryError)
/home/go/src/runtime/signal_unix.go:687 (0x456a68)
sigpanic: panicmem()
/home/gitea-sync/routers/repo/compare.go:218 (0x1991419)
ParseCompareInfo: if ctx.User.ID != 0 {
/home/gitea-sync/routers/repo/compare.go:521 (0x1994e7f)
CompareDiff: headUser, headRepo, headGitRepo, compareInfo, baseBranch, headBranch := ParseCompareInfo(ctx)
/home/go/src/reflect/value.go:460 (0x4a070a)
Value.call: call(frametype, fn, args, uint32(frametype.size), uint32(retOffset))
/home/go/src/reflect/value.go:321 (0x49fc13)
Value.Call: return v.call("Call", in)
/home/gitea-sync/vendor/gitea.com/macaron/inject/inject.go:177 (0xc1b97b)
(*injector).callInvoke: return reflect.ValueOf(f).Call(in), nil
/home/gitea-sync/vendor/gitea.com/macaron/inject/inject.go:137 (0xc1b359)
(*injector).Invoke: return inj.callInvoke(f, t, t.NumIn())
/home/gitea-sync/vendor/gitea.com/macaron/macaron/context.go:121 (0xc368a8)
(*Context).run: vals, err := c.Invoke(c.handler())
/home/gitea-sync/vendor/gitea.com/macaron/macaron/context.go:112 (0x116e06f)
(*Context).Next: c.run()
/home/gitea-sync/modules/context/repo.go:579 (0x116e058)
RepoAssignment.func1: ctx.Next()
/home/go/src/reflect/value.go:460 (0x4a070a)
Value.call: call(frametype, fn, args, uint32(frametype.size), uint32(retOffset))
/home/go/src/reflect/value.go:321 (0x49fc13)
Value.Call: return v.call("Call", in)
/home/gitea-sync/vendor/gitea.com/macaron/inject/inject.go:177 (0xc1b97b)
(*injector).callInvoke: return reflect.ValueOf(f).Call(in), nil
/home/gitea-sync/vendor/gitea.com/macaron/inject/inject.go:137 (0xc1b359)
(*injector).Invoke: return inj.callInvoke(f, t, t.NumIn())
/home/gitea-sync/vendor/gitea.com/macaron/macaron/context.go:121 (0xc368a8)
(*Context).run: vals, err := c.Invoke(c.handler())
/home/gitea-sync/vendor/gitea.com/macaron/macaron/context.go:112 (0x116b964)
(*Context).Next: c.run()
/home/gitea-sync/modules/context/panic.go:39 (0x116b955)
Recovery.func1: ctx.Next()
/home/go/src/reflect/value.go:460 (0x4a070a)
Value.call: call(frametype, fn, args, uint32(frametype.size), uint32(retOffset))
/home/go/src/reflect/value.go:321 (0x49fc13)
Value.Call: return v.call("Call", in)
/home/gitea-sync/vendor/gitea.com/macaron/inject/inject.go:177 (0xc1b97b)
(*injector).callInvoke: return reflect.ValueOf(f).Call(in), nil
/home/gitea-sync/vendor/gitea.com/macaron/inject/inject.go:137 (0xc1b359)
(*injector).Invoke: return inj.callInvoke(f, t, t.NumIn())
/home/gitea-sync/vendor/gitea.com/macaron/macaron/context.go:121 (0xc368a8)
(*Context).run: vals, err := c.Invoke(c.handler())
/home/gitea-sync/vendor/gitea.com/macaron/macaron/context.go:112 (0x1123935)
(*Context).Next: c.run()
/home/gitea-sync/vendor/gitea.com/macaron/session/session.go:192 (0x1123920)
Sessioner.func1: ctx.Next()
/home/gitea-sync/vendor/gitea.com/macaron/macaron/context.go:79 (0xc36750)
ContextInvoker.Invoke: invoke(params[0].(*Context))
/home/gitea-sync/vendor/gitea.com/macaron/inject/inject.go:157 (0xc1b6a7)
(*injector).fastInvoke: return f.Invoke(in)
/home/gitea-sync/vendor/gitea.com/macaron/inject/inject.go:135 (0xc1b448)
(*injector).Invoke: return inj.fastInvoke(v, t, t.NumIn())
/home/gitea-sync/vendor/gitea.com/macaron/macaron/context.go:121 (0xc368a8)
(*Context).run: vals, err := c.Invoke(c.handler())
/home/gitea-sync/vendor/gitea.com/macaron/macaron/context.go:112 (0xc47cd5)
(*Context).Next: c.run()
/home/gitea-sync/vendor/gitea.com/macaron/macaron/recovery.go:161 (0xc47cc8)
Recovery.func1: c.Next()
/home/gitea-sync/vendor/gitea.com/macaron/macaron/logger.go:40 (0xc3a313)
LoggerInvoker.Invoke: invoke(params[0].(*Context), params[1].(*log.Logger))
/home/gitea-sync/vendor/gitea.com/macaron/inject/inject.go:157 (0xc1b6a7)
(*injector).fastInvoke: return f.Invoke(in)
/home/gitea-sync/vendor/gitea.com/macaron/inject/inject.go:135 (0xc1b448)
(*injector).Invoke: return inj.fastInvoke(v, t, t.NumIn())
/home/gitea-sync/vendor/gitea.com/macaron/macaron/context.go:121 (0xc368a8)
(*Context).run: vals, err := c.Invoke(c.handler())
/home/gitea-sync/vendor/gitea.com/macaron/macaron/context.go:112 (0xc47000)
(*Context).Next: c.run()
/home/gitea-sync/vendor/gitea.com/macaron/macaron/logger.go:52 (0xc46feb)
Logger.func1: ctx.Next()
/home/gitea-sync/vendor/gitea.com/macaron/macaron/logger.go:40 (0xc3a313)
LoggerInvoker.Invoke: invoke(params[0].(*Context), params[1].(*log.Logger))
/home/gitea-sync/vendor/gitea.com/macaron/inject/inject.go:157 (0xc1b6a7)
(*injector).fastInvoke: return f.Invoke(in)
/home/gitea-sync/vendor/gitea.com/macaron/inject/inject.go:135 (0xc1b448)
(*injector).Invoke: return inj.fastInvoke(v, t, t.NumIn())
/home/gitea-sync/vendor/gitea.com/macaron/macaron/context.go:121 (0xc368a8)
(*Context).run: vals, err := c.Invoke(c.handler())
/home/gitea-sync/vendor/gitea.com/macaron/macaron/router.go:187 (0xc48ee6)
(*Router).Handle.func1: c.run()
/home/gitea-sync/vendor/gitea.com/macaron/macaron/router.go:303 (0xc428e5)
(*Router).ServeHTTP: h(rw, req, p)
/home/gitea-sync/vendor/gitea.com/macaron/macaron/macaron.go:218 (0xc3b66a)
(*Macaron).ServeHTTP: m.Router.ServeHTTP(rw, req)
/home/gitea-sync/vendor/github.com/gorilla/context/context.go:141 (0xead023)
ClearHandler.func1: h.ServeHTTP(w, r)
/home/go/src/net/http/server.go:2012 (0x7582c3)
HandlerFunc.ServeHTTP: f(w, r)
/home/go/src/net/http/server.go:2807 (0x75b652)
serverHandler.ServeHTTP: handler.ServeHTTP(rw, req)
/home/go/src/net/http/server.go:1895 (0x7570cb)
(*conn).serve: serverHandler{c.server}.ServeHTTP(w, w.req)
/home/go/src/runtime/asm_amd64.s:1373 (0x472c10)
goexit: BYTE $0x90 // NOP

@zeripath
Copy link
Contributor

Thanks I've already put up a fix - it was actually very simple to reproduce.

I unfortunately caused it.

@L0veSunshine
Copy link
Contributor Author

Thanks I've already put up a fix - it was actually very simple to reproduce.

I unfortunately caused it.

The code in compare.go is really awful before your commit.
By the way, your annotate is clearly and useful.
Thanks for your pr.

techknowlogick added a commit that referenced this issue May 15, 2020
Fix #11423

Signed-off-by: Andrew Thornton <[email protected]>

Co-authored-by: techknowlogick <[email protected]>
ydelafollye pushed a commit to ydelafollye/gitea that referenced this issue Jul 31, 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
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants