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

repos/search returns error 500 Internal Server Error #1643

Closed
2 of 7 tasks
jonasfranz opened this issue Apr 29, 2017 · 2 comments · Fixed by #1645
Closed
2 of 7 tasks

repos/search returns error 500 Internal Server Error #1643

jonasfranz opened this issue Apr 29, 2017 · 2 comments · Fixed by #1645
Assignees
Labels
Milestone

Comments

@jonasfranz
Copy link
Member

jonasfranz commented Apr 29, 2017

Description

Conditions:
Repositories in Gitea:

  • Test

Case 1) If I search for the "Test" (q=Test) repository via /repos/search (https://github.com/gogits/go-gogs-client/wiki/Repositories) I receive Error 500 "Internal Server Error".

Case 2) If I search for any other text like "Example" I receive a correct response:
{"data":[],"ok":true}

Console output (Case 1)

[Macaron] 2017-04-29 16:01:58: Started GET /api/v1/repos/search?q=Test for [::1]
[Macaron] PANIC: runtime error: invalid memory address or nil pointer dereference
C:/Go/src/runtime/panic.go:489 (0x42cf1d)
        gopanic: reflectcall(nil, unsafe.Pointer(d.fn), deferArgs(d), uint32(d.siz), uint32(d.siz))
C:/Go/src/runtime/panic.go:63 (0x42bd75)
        panicmem: panic(memoryError)
C:/Go/src/runtime/signal_windows.go:161 (0x440d5b)
        sigpanic: panicmem()
C:/Users/Jonas/go/src/code.gitea.io/gitea/routers/api/v1/repo/repo.go:79 (0xdd0a7a)
        Search: accessMode, err := models.AccessLevel(ctx.User.ID, repo)
C:/Go/src/runtime/asm_amd64.s:514 (0x45814f)
        call32: CALLFN(·call32, 32)
C:/Go/src/reflect/value.go:434 (0x4d7dc6)
        Value.call: call(frametype, fn, args, uint32(frametype.size), uint32(retOffset))
C:/Go/src/reflect/value.go:302 (0x4d736b)
        Value.Call: return v.call("Call", in)
C:/Users/Jonas/go/src/code.gitea.io/gitea/vendor/github.com/go-macaron/inject/inject.go:177 (0x875416)
        (*injector).callInvoke: return reflect.ValueOf(f).Call(in), nil
C:/Users/Jonas/go/src/code.gitea.io/gitea/vendor/github.com/go-macaron/inject/inject.go:137 (0x874dc1)
        (*injector).Invoke: return inj.callInvoke(f, t, t.NumIn())
C:/Users/Jonas/go/src/code.gitea.io/gitea/vendor/gopkg.in/macaron.v1/context.go:113 (0x8a2799)
        (*Context).run: vals, err := c.Invoke(c.handler())
C:/Users/Jonas/go/src/code.gitea.io/gitea/vendor/gopkg.in/macaron.v1/context.go:104 (0x8a26ad)
        (*Context).Next: c.run()
C:/Users/Jonas/go/src/code.gitea.io/gitea/vendor/github.com/go-macaron/session/session.go:186 (0x8fc167)
        Sessioner.func1: ctx.Next()
C:/Go/src/runtime/asm_amd64.s:514 (0x45814f)
        call32: CALLFN(·call32, 32)
C:/Go/src/reflect/value.go:434 (0x4d7dc6)
        Value.call: call(frametype, fn, args, uint32(frametype.size), uint32(retOffset))
C:/Go/src/reflect/value.go:302 (0x4d736b)
        Value.Call: return v.call("Call", in)
C:/Users/Jonas/go/src/code.gitea.io/gitea/vendor/github.com/go-macaron/inject/inject.go:177 (0x875416)
        (*injector).callInvoke: return reflect.ValueOf(f).Call(in), nil
C:/Users/Jonas/go/src/code.gitea.io/gitea/vendor/github.com/go-macaron/inject/inject.go:137 (0x874dc1)
        (*injector).Invoke: return inj.callInvoke(f, t, t.NumIn())
C:/Users/Jonas/go/src/code.gitea.io/gitea/vendor/gopkg.in/macaron.v1/context.go:113 (0x8a2799)
        (*Context).run: vals, err := c.Invoke(c.handler())
C:/Users/Jonas/go/src/code.gitea.io/gitea/vendor/gopkg.in/macaron.v1/context.go:104 (0x8a26ad)
        (*Context).Next: c.run()
C:/Users/Jonas/go/src/code.gitea.io/gitea/vendor/gopkg.in/macaron.v1/recovery.go:161 (0x8b5cd2)
        Recovery.func1: c.Next()
C:/Go/src/runtime/asm_amd64.s:514 (0x45814f)
        call32: CALLFN(·call32, 32)
C:/Go/src/reflect/value.go:434 (0x4d7dc6)
        Value.call: call(frametype, fn, args, uint32(frametype.size), uint32(retOffset))
C:/Go/src/reflect/value.go:302 (0x4d736b)
        Value.Call: return v.call("Call", in)
C:/Users/Jonas/go/src/code.gitea.io/gitea/vendor/github.com/go-macaron/inject/inject.go:177 (0x875416)
        (*injector).callInvoke: return reflect.ValueOf(f).Call(in), nil
C:/Users/Jonas/go/src/code.gitea.io/gitea/vendor/github.com/go-macaron/inject/inject.go:137 (0x874dc1)
        (*injector).Invoke: return inj.callInvoke(f, t, t.NumIn())
C:/Users/Jonas/go/src/code.gitea.io/gitea/vendor/gopkg.in/macaron.v1/context.go:113 (0x8a2799)
        (*Context).run: vals, err := c.Invoke(c.handler())
C:/Users/Jonas/go/src/code.gitea.io/gitea/vendor/gopkg.in/macaron.v1/context.go:104 (0x8a26ad)
        (*Context).Next: c.run()
C:/Users/Jonas/go/src/code.gitea.io/gitea/vendor/gopkg.in/macaron.v1/logger.go:43 (0x8b4f8b)
        Logger.func1: ctx.Next()
C:/Go/src/runtime/asm_amd64.s:514 (0x45814f)
        call32: CALLFN(·call32, 32)
C:/Go/src/reflect/value.go:434 (0x4d7dc6)
        Value.call: call(frametype, fn, args, uint32(frametype.size), uint32(retOffset))
C:/Go/src/reflect/value.go:302 (0x4d736b)
        Value.Call: return v.call("Call", in)
C:/Users/Jonas/go/src/code.gitea.io/gitea/vendor/github.com/go-macaron/inject/inject.go:177 (0x875416)
        (*injector).callInvoke: return reflect.ValueOf(f).Call(in), nil
C:/Users/Jonas/go/src/code.gitea.io/gitea/vendor/github.com/go-macaron/inject/inject.go:137 (0x874dc1)
        (*injector).Invoke: return inj.callInvoke(f, t, t.NumIn())
C:/Users/Jonas/go/src/code.gitea.io/gitea/vendor/gopkg.in/macaron.v1/context.go:113 (0x8a2799)
        (*Context).run: vals, err := c.Invoke(c.handler())
C:/Users/Jonas/go/src/code.gitea.io/gitea/vendor/gopkg.in/macaron.v1/router.go:184 (0x8b6ff0)
        (*Router).Handle.func1: c.run()
C:/Users/Jonas/go/src/code.gitea.io/gitea/vendor/gopkg.in/macaron.v1/router.go:288 (0x8aef84)
        (*Router).ServeHTTP: h(rw, req, p)
C:/Users/Jonas/go/src/code.gitea.io/gitea/vendor/gopkg.in/macaron.v1/macaron.go:177 (0x8a6cd3)
        (*Macaron).ServeHTTP: m.Router.ServeHTTP(rw, req)
C:/Users/Jonas/go/src/code.gitea.io/gitea/vendor/github.com/gorilla/context/context.go:141 (0xad8562)
        ClearHandler.func1: h.ServeHTTP(w, r)
C:/Go/src/net/http/server.go:1942 (0x6e280b)
        HandlerFunc.ServeHTTP: f(w, r)
C:/Go/src/net/http/server.go:2568 (0x6e5159)
        serverHandler.ServeHTTP: handler.ServeHTTP(rw, req)
C:/Go/src/net/http/server.go:1825 (0x6e1359)
        (*conn).serve: serverHandler{c.server}.ServeHTTP(w, w.req)
C:/Go/src/runtime/asm_amd64.s:2197 (0x45a931)
        goexit: BYTE    $0x90   // NOP
[Macaron] 2017-04-29 16:01:58: Completed /api/v1/repos/search?q=Test 500 Internal Server Error in 128.0074ms

`
@cez81
Copy link
Contributor

cez81 commented Apr 29, 2017

Fixed with #1622

Edit:: Hmm, or maybe not still seems to be issues with it. 500 on https://try.gitea.io/ if not signed in.

Edit2:: PR#1622 was in user/repo.go, problem is the same though. ctx.User is not set unless signed in.

@bkcsoft
Copy link
Member

bkcsoft commented Apr 29, 2017

woho. Another ctx.User != nil bug 😂

@lunny lunny added this to the 1.2.0 milestone Apr 30, 2017
@lunny lunny added the type/bug label Apr 30, 2017
@lunny lunny self-assigned this Apr 30, 2017
lunny added a commit to lunny/gitea that referenced this issue Apr 30, 2017
@go-gitea go-gitea locked and limited conversation to collaborators Nov 23, 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.

4 participants