Skip to content

PANIC: runtime error: invalid memory address or nil pointer dereference #24856

@sleepdan

Description

@sleepdan

Description

The application is not working. After downloading the source:
git clone https://github.com/go-gitea/gitea.git
and builds :
TAGS="bindata" make build

I start the application:
./gitea web

When trying to open the page in browser: http://localhost:3000/
Error is displayed "Internal server error, please collect error logs and report to Gitea issue tracker"
However, in the error logs:
2023/05/22 16:56:40 cmd/web.go:123:runWeb() [I] Starting Gitea on PID: 22163
2023/05/22 16:56:40 ...s/install/setting.go:22:PreloadSettings() [I] AppPath: /Users/18493151/develop/go/gitea/gitea
2023/05/22 16:56:40 ...s/install/setting.go:23:PreloadSettings() [I] AppWorkPath: /Users/18493151/develop/go/gitea
2023/05/22 16:56:40 ...s/install/setting.go:24:PreloadSettings() [I] Custom path: /Users/18493151/develop/go/gitea/custom
2023/05/22 16:56:40 ...s/install/setting.go:25:PreloadSettings() [I] Log path: /Users/18493151/develop/go/gitea/log
2023/05/22 16:56:40 ...s/install/setting.go:26:PreloadSettings() [I] Configuration file: /Users/18493151/develop/go/gitea/custom/conf/app.ini
2023/05/22 16:56:40 ...s/install/setting.go:27:PreloadSettings() [I] Prepare to run install page
2023/05/22 16:56:41 cmd/web.go:237:listen() [I] Listen: http://0.0.0.0:3000
2023/05/22 16:56:41 cmd/web.go:241:listen() [I] AppURL(ROOT_URL): http://localhost:3000/
2023/05/22 16:56:41 ...s/graceful/server.go:62:NewServer() [I] Starting new Web server: tcp:0.0.0.0:3000 on PID: 22163
2023/05/22 16:56:49 ...rs/common/errpage.go:25:RenderPanicErrorPage() [E] PANIC: runtime error: invalid memory address or nil pointer dereference
/Users/18493151/gosdk/go1.20.4/src/runtime/panic.go:884 (0x10003a8f2)
gopanic: done = runOpenDeferFrame(d)
/Users/18493151/gosdk/go1.20.4/src/runtime/panic.go:260 (0x100051e7c)
panicmem: panic(memoryError)
/Users/18493151/gosdk/go1.20.4/src/runtime/signal_unix.go:837 (0x100051e4c)
sigpanic: panicmem()
/Users/18493151/develop/go/gitea/routers/install/install.go:114 (0x1022dbffd)
Install: ctx.Data["CurDbType"] = curDBType
/Users/18493151/gosdk/go1.20.4/src/reflect/value.go:586 (0x1000a824a)
Value.call: call(frametype, fn, stackArgs, uint32(frametype.size), uint32(abid.retOffset), uint32(frameSize), &regArgs)
/Users/18493151/gosdk/go1.20.4/src/reflect/value.go:370 (0x1000a74fb)
Value.Call: return v.call("Call", in)
/Users/18493151/develop/go/gitea/modules/web/handler.go:176 (0x101f0c765)
toHandlerProvider.func2.1: ret := fn.Call(argsIn)
/Users/18493151/gosdk/go1.20.4/src/net/http/server.go:2122 (0x10058b5ce)
HandlerFunc.ServeHTTP: f(w, r)
/Users/18493151/gosdk/go1.20.4/src/net/http/server.go:2122 (0x10058b5ce)
HandlerFunc.ServeHTTP: f(w, r)
/Users/18493151/develop/go/pkg/mod/github.com/go-chi/chi/v5@v5.0.8/chain.go:31 (0x1013e06cb)
(*ChainHandler).ServeHTTP: c.chain.ServeHTTP(w, r)
/Users/18493151/develop/go/pkg/mod/github.com/go-chi/chi/v5@v5.0.8/mux.go:444 (0x1013e35d5)
(*Mux).routeHTTP: h.ServeHTTP(w, r)
/Users/18493151/gosdk/go1.20.4/src/net/http/server.go:2122 (0x10058b5ce)
HandlerFunc.ServeHTTP: f(w, r)
/Users/18493151/develop/go/gitea/routers/install/install.go:80 (0x1022dbd81)
Contexter.func1.1: next.ServeHTTP(resp, ctx.Req)
/Users/18493151/gosdk/go1.20.4/src/net/http/server.go:2122 (0x10058b5ce)
HandlerFunc.ServeHTTP: f(w, r)
/Users/18493151/develop/go/gitea/modules/web/handler.go:155 (0x101f0ca2b)
toHandlerProvider.func1.1: h.ServeHTTP(resp, req)
/Users/18493151/gosdk/go1.20.4/src/net/http/server.go:2122 (0x10058b5ce)
HandlerFunc.ServeHTTP: f(w, r)
/Users/18493151/develop/go/pkg/mod/gitea.com/go-chi/session@v0.0.0-20230415140235-3182bcc14852/session.go:257 (0x10144acaa)
Sessioner.func1.1: next.ServeHTTP(w, req)
/Users/18493151/gosdk/go1.20.4/src/net/http/server.go:2122 (0x10058b5ce)
HandlerFunc.ServeHTTP: f(w, r)
/Users/18493151/develop/go/gitea/modules/web/handler.go:155 (0x101f0ca2b)
toHandlerProvider.func1.1: h.ServeHTTP(resp, req)
/Users/18493151/gosdk/go1.20.4/src/net/http/server.go:2122 (0x10058b5ce)
HandlerFunc.ServeHTTP: f(w, r)
/Users/18493151/develop/go/pkg/mod/github.com/go-chi/chi/v5@v5.0.8/mux.go:73 (0x1013e1354)
(*Mux).ServeHTTP: mx.handler.ServeHTTP(w, r)
/Users/18493151/develop/go/pkg/mod/github.com/go-chi/chi/v5@v5.0.8/mux.go:316 (0x1013e2d63)
(*Mux).Mount.func1: handler.ServeHTTP(w, r)
/Users/18493151/gosdk/go1.20.4/src/net/http/server.go:2122 (0x10058b5ce)
HandlerFunc.ServeHTTP: f(w, r)
/Users/18493151/develop/go/pkg/mod/github.com/go-chi/chi/v5@v5.0.8/mux.go:444 (0x1013e35d5)
(*Mux).routeHTTP: h.ServeHTTP(w, r)
/Users/18493151/gosdk/go1.20.4/src/net/http/server.go:2122 (0x10058b5ce)
HandlerFunc.ServeHTTP: f(w, r)
/Users/18493151/develop/go/pkg/mod/github.com/chi-middleware/proxy@v1.1.1/middleware.go:37 (0x1020629d6)
ForwardedHeaders.func1.1: h.ServeHTTP(w, r)
/Users/18493151/gosdk/go1.20.4/src/net/http/server.go:2122 (0x10058b5ce)
HandlerFunc.ServeHTTP: f(w, r)
/Users/18493151/develop/go/gitea/modules/web/handler.go:155 (0x101f0ca2b)
toHandlerProvider.func1.1: h.ServeHTTP(resp, req)
/Users/18493151/gosdk/go1.20.4/src/net/http/server.go:2122 (0x10058b5ce)
HandlerFunc.ServeHTTP: f(w, r)
/Users/18493151/develop/go/gitea/routers/common/middleware.go:45 (0x1020659d4)
ProtocolMiddlewares.func2.1: next.ServeHTTP(context.WrapResponseWriter(resp), req.WithContext(cache.WithCacheContext(ctx)))
/Users/18493151/gosdk/go1.20.4/src/net/http/server.go:2122 (0x10058b5ce)
HandlerFunc.ServeHTTP: f(w, r)
/Users/18493151/develop/go/gitea/modules/web/handler.go:155 (0x101f0ca2b)
toHandlerProvider.func1.1: h.ServeHTTP(resp, req)
/Users/18493151/gosdk/go1.20.4/src/net/http/server.go:2122 (0x10058b5ce)
HandlerFunc.ServeHTTP: f(w, r)
/Users/18493151/develop/go/gitea/routers/common/middleware.go:37 (0x1020654ef)
ProtocolMiddlewares.func1.1: next.ServeHTTP(resp, req)
/Users/18493151/gosdk/go1.20.4/src/net/http/server.go:2122 (0x10058b5ce)
HandlerFunc.ServeHTTP: f(w, r)
/Users/18493151/develop/go/gitea/modules/web/handler.go:155 (0x101f0ca2b)
toHandlerProvider.func1.1: h.ServeHTTP(resp, req)
/Users/18493151/gosdk/go1.20.4/src/net/http/server.go:2122 (0x10058b5ce)
HandlerFunc.ServeHTTP: f(w, r)
/Users/18493151/develop/go/gitea/routers/common/middleware.go:99 (0x102064ba9)
stripSlashesMiddleware.func1: next.ServeHTTP(resp, req)
/Users/18493151/gosdk/go1.20.4/src/net/http/server.go:2122 (0x10058b5ce)
HandlerFunc.ServeHTTP: f(w, r)
/Users/18493151/develop/go/gitea/modules/web/handler.go:155 (0x101f0ca2b)
toHandlerProvider.func1.1: h.ServeHTTP(resp, req)
/Users/18493151/gosdk/go1.20.4/src/net/http/server.go:2122 (0x10058b5ce)
HandlerFunc.ServeHTTP: f(w, r)
/Users/18493151/develop/go/pkg/mod/github.com/go-chi/chi/v5@v5.0.8/mux.go:90 (0x1013e130f)
(*Mux).ServeHTTP: mx.handler.ServeHTTP(w, r)
/Users/18493151/develop/go/gitea/modules/web/route.go:166 (0x101f0dd0d)
(*Route).ServeHTTP: r.R.ServeHTTP(w, req)
/Users/18493151/gosdk/go1.20.4/src/net/http/server.go:2936 (0x10058ebd5)
serverHandler.ServeHTTP: handler.ServeHTTP(rw, req)
/Users/18493151/gosdk/go1.20.4/src/net/http/server.go:1995 (0x10058a0f1)
(*conn).serve: serverHandler{c.server}.ServeHTTP(w, w.req)
/Users/18493151/gosdk/go1.20.4/src/runtime/asm_amd64.s:1598 (0x100072660)
goexit: BYTE $0x90 // NOP
^C2023/05/22 16:57:18 ...eful/manager_unix.go:196:handleSignals() [W] PID 22163. Received SIGINT. Shutting down...
2023/05/22 16:57:18 cmd/web.go:288:listen() [I] HTTP Listener: 0.0.0.0:3000 Closed
2023/05/22 16:57:18 .../graceful/manager.go:205:doHammerTime() [W] Setting Hammer condition
2023/05/22 16:57:18 ...eful/server_hooks.go:46:doShutdown() [I] PID: 22163 Listener ([::]:3000) closed.
2023/05/22 16:57:19 .../graceful/manager.go:224:doTerminate() [W] Terminating
2023/05/22 16:57:19 ...eful/manager_unix.go:209:handleSignals() [W] PID: 22163. Background context for manager closed - context canceled - Shutting down...
2023/05/22 16:57:19 cmd/web.go:156:runWeb() [I] PID: 22163 Gitea Web Finished

Gitea Version

1.20

Can you reproduce the bug on the Gitea demo site?

No

Log Gist

No response

Screenshots

No response

Git Version

No response

Operating System

MacOS

How are you running Gitea?

a command-line: ./gitea web

Database

PostgreSQL

Activity

sleepdan

sleepdan commented on May 22, 2023

@sleepdan
Author

sorry version is 1.19.3

self-assigned this
on May 22, 2023
wxiaoguang

wxiaoguang commented on May 22, 2023

@wxiaoguang
Contributor

It is 1.20

Fix install page context, make the install page tests really test #24858

added a commit that references this issue on May 23, 2023
abcf5a7
added a commit that references this issue on Jun 9, 2023
f11fb8e
locked as resolved and limited conversation to collaborators on Jul 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

    Development

    Participants

    @wxiaoguang@sleepdan

    Issue actions

      PANIC: runtime error: invalid memory address or nil pointer dereference · Issue #24856 · go-gitea/gitea