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

Gitea 1.16.6: PANIC: runtime error: invalid memory address or nil pointer dereference #19613

Closed
prologic opened this issue May 5, 2022 · 13 comments · Fixed by #19625
Closed
Labels
issue/confirmed Issue has been reviewed and confirmed to be present or accepted to be implemented type/bug
Milestone

Comments

@prologic
Copy link

prologic commented May 5, 2022

Description

Crash in one of the handlers (regression in 1.16.6):

2022/05/05 02:45:40 Started GET /marado/yarn/compare/master...new_ui?style=unified&whitespace=ignore-all for 216.244.66.235:0
2022/05/05 02:45:40 routers/web/base.go:130:1() [E] PANIC: runtime error: invalid memory address or nil pointer dereference
	/usr/local/go/src/runtime/panic.go:220 (0x457635)
	/usr/local/go/src/runtime/signal_unix.go:818 (0x457605)
	/go/src/code.gitea.io/gitea/models/repo.go:135 (0x138cf96)
	/go/src/code.gitea.io/gitea/models/repo.go:131 (0x1ea7944)
	/go/src/code.gitea.io/gitea/routers/web/repo/compare.go:448 (0x1ea791a)
	/go/src/code.gitea.io/gitea/routers/web/repo/compare.go:683 (0x1ea9c69)
	/go/src/code.gitea.io/gitea/modules/web/route.go:74 (0x1e47d44)
	/usr/local/go/src/net/http/server.go:2084 (0x7ac6ce)
	/go/pkg/mod/github.com/go-chi/chi/v5@v5.0.7/mux.go:442 (0x1656dd5)
	/usr/local/go/src/net/http/server.go:2084 (0x7ac6ce)
	/go/src/code.gitea.io/gitea/modules/web/route.go:113 (0x1e48531)
	/usr/local/go/src/net/http/server.go:2084 (0x7ac6ce)
	/go/src/code.gitea.io/gitea/modules/web/route.go:113 (0x1e48531)
	/usr/local/go/src/net/http/server.go:2084 (0x7ac6ce)
	/go/src/code.gitea.io/gitea/modules/web/route.go:113 (0x1e48531)
	/usr/local/go/src/net/http/server.go:2084 (0x7ac6ce)
	/go/pkg/mod/github.com/go-chi/chi/v5@v5.0.7/middleware/get_head.go:37 (0x1e77de4)
	/usr/local/go/src/net/http/server.go:2084 (0x7ac6ce)
	/go/src/code.gitea.io/gitea/modules/web/route.go:113 (0x1e48531)
	/usr/local/go/src/net/http/server.go:2084 (0x7ac6ce)
	/go/src/code.gitea.io/gitea/modules/context/context.go:745 (0x1668786)
	/usr/local/go/src/net/http/server.go:2084 (0x7ac6ce)
	/go/pkg/mod/github.com/go-chi/chi/v5@v5.0.7/mux.go:71 (0x1654c0c)
	/go/pkg/mod/github.com/go-chi/chi/v5@v5.0.7/mux.go:314 (0x16565bb)
	/usr/local/go/src/net/http/server.go:2084 (0x7ac6ce)
	/go/pkg/mod/github.com/go-chi/chi/v5@v5.0.7/mux.go:442 (0x1656dd5)
	/usr/local/go/src/net/http/server.go:2084 (0x7ac6ce)
	/go/src/code.gitea.io/gitea/routers/web/base.go:169 (0x20332d1)
	/usr/local/go/src/net/http/server.go:2084 (0x7ac6ce)
	/go/pkg/mod/gitea.com/go-chi/session@v0.0.0-20211218221615-e3605d8b28b8/session.go:257 (0x146137d)
	/usr/local/go/src/net/http/server.go:2084 (0x7ac6ce)
	/go/src/code.gitea.io/gitea/modules/public/public.go:42 (0x15949db)
	/usr/local/go/src/net/http/server.go:2084 (0x7ac6ce)
	/go/pkg/mod/github.com/go-chi/chi/v5@v5.0.7/mux.go:71 (0x1654c0c)
	/go/pkg/mod/github.com/go-chi/chi/v5@v5.0.7/mux.go:314 (0x16565bb)
	/usr/local/go/src/net/http/server.go:2084 (0x7ac6ce)
	/go/pkg/mod/github.com/go-chi/chi/v5@v5.0.7/mux.go:442 (0x1656dd5)
	/usr/local/go/src/net/http/server.go:2084 (0x7ac6ce)
	/go/src/code.gitea.io/gitea/routers/common/middleware.go:78 (0x1e7dfc1)
	/usr/local/go/src/net/http/server.go:2084 (0x7ac6ce)
	/go/src/code.gitea.io/gitea/routers/common/logger.go:23 (0x1e7d24f)
	/usr/local/go/src/net/http/server.go:2084 (0x7ac6ce)
	/go/pkg/mod/github.com/go-chi/chi/v5@v5.0.7/middleware/strip.go:30 (0x1e7ab58)
	/usr/local/go/src/net/http/server.go:2084 (0x7ac6ce)
	/go/pkg/mod/github.com/chi-middleware/proxy@v1.1.1/middleware.go:37 (0x1e77456)
	/usr/local/go/src/net/http/server.go:2084 (0x7ac6ce)
	/go/src/code.gitea.io/gitea/routers/common/middleware.go:31 (0x1e7de19)
	/usr/local/go/src/net/http/server.go:2084 (0x7ac6ce)
	/go/pkg/mod/github.com/go-chi/chi/v5@v5.0.7/mux.go:88 (0x1654bc1)
	/go/src/code.gitea.io/gitea/modules/web/route.go:328 (0x1e4b38d)
	/usr/local/go/src/net/http/server.go:2916 (0x7afcba)
	/usr/local/go/src/net/http/server.go:1966 (0x7ab176)
	/usr/local/go/src/runtime/asm_amd64.s:1571 (0x4745a0)

2022/05/05 02:45:40 Completed GET /marado/yarn/compare/master...new_ui?style=unified&whitespace=ignore-all 500 Internal Server Error in 43.252646ms

Gitea Version

1.16.7

Can you reproduce the bug on the Gitea demo site?

Yes

Log Gist

2022/05/05 02:45:40 Started GET /marado/yarn/compare/master...new_ui?style=unified&whitespace=ignore-all for 216.244.66.235:0 2022/05/05 02:45:40 routers/web/base.go:130:1() [E] PANIC: runtime error: invalid memory address or nil pointer dereference /usr/local/go/src/runtime/panic.go:220 (0x457635) /usr/local/go/src/runtime/signal_unix.go:818 (0x457605) /go/src/code.gitea.io/gitea/models/repo.go:135 (0x138cf96) /go/src/code.gitea.io/gitea/models/repo.go:131 (0x1ea7944) /go/src/code.gitea.io/gitea/routers/web/repo/compare.go:448 (0x1ea791a) /go/src/code.gitea.io/gitea/routers/web/repo/compare.go:683 (0x1ea9c69) /go/src/code.gitea.io/gitea/modules/web/route.go:74 (0x1e47d44) /usr/local/go/src/net/http/server.go:2084 (0x7ac6ce) /go/pkg/mod/github.com/go-chi/chi/v5@v5.0.7/mux.go:442 (0x1656dd5) /usr/local/go/src/net/http/server.go:2084 (0x7ac6ce) /go/src/code.gitea.io/gitea/modules/web/route.go:113 (0x1e48531) /usr/local/go/src/net/http/server.go:2084 (0x7ac6ce) /go/src/code.gitea.io/gitea/modules/web/route.go:113 (0x1e48531) /usr/local/go/src/net/http/server.go:2084 (0x7ac6ce) /go/src/code.gitea.io/gitea/modules/web/route.go:113 (0x1e48531) /usr/local/go/src/net/http/server.go:2084 (0x7ac6ce) /go/pkg/mod/github.com/go-chi/chi/v5@v5.0.7/middleware/get_head.go:37 (0x1e77de4) /usr/local/go/src/net/http/server.go:2084 (0x7ac6ce) /go/src/code.gitea.io/gitea/modules/web/route.go:113 (0x1e48531) /usr/local/go/src/net/http/server.go:2084 (0x7ac6ce) /go/src/code.gitea.io/gitea/modules/context/context.go:745 (0x1668786) /usr/local/go/src/net/http/server.go:2084 (0x7ac6ce) /go/pkg/mod/github.com/go-chi/chi/v5@v5.0.7/mux.go:71 (0x1654c0c) /go/pkg/mod/github.com/go-chi/chi/v5@v5.0.7/mux.go:314 (0x16565bb) /usr/local/go/src/net/http/server.go:2084 (0x7ac6ce) /go/pkg/mod/github.com/go-chi/chi/v5@v5.0.7/mux.go:442 (0x1656dd5) /usr/local/go/src/net/http/server.go:2084 (0x7ac6ce) /go/src/code.gitea.io/gitea/routers/web/base.go:169 (0x20332d1) /usr/local/go/src/net/http/server.go:2084 (0x7ac6ce) /go/pkg/mod/gitea.com/go-chi/session@v0.0.0-20211218221615-e3605d8b28b8/session.go:257 (0x146137d) /usr/local/go/src/net/http/server.go:2084 (0x7ac6ce) /go/src/code.gitea.io/gitea/modules/public/public.go:42 (0x15949db) /usr/local/go/src/net/http/server.go:2084 (0x7ac6ce) /go/pkg/mod/github.com/go-chi/chi/v5@v5.0.7/mux.go:71 (0x1654c0c) /go/pkg/mod/github.com/go-chi/chi/v5@v5.0.7/mux.go:314 (0x16565bb) /usr/local/go/src/net/http/server.go:2084 (0x7ac6ce) /go/pkg/mod/github.com/go-chi/chi/v5@v5.0.7/mux.go:442 (0x1656dd5) /usr/local/go/src/net/http/server.go:2084 (0x7ac6ce) /go/src/code.gitea.io/gitea/routers/common/middleware.go:78 (0x1e7dfc1) /usr/local/go/src/net/http/server.go:2084 (0x7ac6ce) /go/src/code.gitea.io/gitea/routers/common/logger.go:23 (0x1e7d24f) /usr/local/go/src/net/http/server.go:2084 (0x7ac6ce) /go/pkg/mod/github.com/go-chi/chi/v5@v5.0.7/middleware/strip.go:30 (0x1e7ab58) /usr/local/go/src/net/http/server.go:2084 (0x7ac6ce) /go/pkg/mod/github.com/chi-middleware/proxy@v1.1.1/middleware.go:37 (0x1e77456) /usr/local/go/src/net/http/server.go:2084 (0x7ac6ce) /go/src/code.gitea.io/gitea/routers/common/middleware.go:31 (0x1e7de19) /usr/local/go/src/net/http/server.go:2084 (0x7ac6ce) /go/pkg/mod/github.com/go-chi/chi/v5@v5.0.7/mux.go:88 (0x1654bc1) /go/src/code.gitea.io/gitea/modules/web/route.go:328 (0x1e4b38d) /usr/local/go/src/net/http/server.go:2916 (0x7afcba) /usr/local/go/src/net/http/server.go:1966 (0x7ab176) /usr/local/go/src/runtime/asm_amd64.s:1571 (0x4745a0) 2022/05/05 02:45:40 Completed GET /marado/yarn/compare/master...new_ui?style=unified&whitespace=ignore-all 500 Internal Server Error in 43.252646ms

Screenshots

No response

Git Version

N/A

Operating System

N/A

How are you running Gitea?

Docker Swarm

Database

SQLite

@wxiaoguang wxiaoguang added the issue/confirmed Issue has been reviewed and confirmed to be present or accepted to be implemented label May 5, 2022
@wxiaoguang wxiaoguang added this to the 1.16.8 milestone May 5, 2022
@number42net
Copy link

I'm running into this issue as well, is there any workaround? This bug is presenting a 500 error on the Gitea users landing page.

@zeripath
Copy link
Contributor

zeripath commented May 5, 2022

Please could you give the link for the reproducer on try.gitea.io

zeripath added a commit to zeripath/gitea that referenced this issue May 5, 2022
CheckRepoUnitUser should tolerate nil users.

Fix go-gitea#19613

Signed-off-by: Andrew Thornton <art27@cantab.net>
@prologic
Copy link
Author

prologic commented May 5, 2022

Please could you give the link for the reproducer on try.gitea.io

I'm sorry I don't have time to reproduce on a "demo" instance. The bug is quite clear, you have a full traceback. I even gave you a point in time where the regression occurred. At this point I can probably easily rollback to 1.16.5

@number42net
Copy link

@prologic I've tried rolling back myself, but I'm still getting the same issue.

@zeripath I encountered it while running a migration, I tried cloning the last repo I worked on before getting the error. Initially I got an 500 error on the repo page, but that's gone after refreshing, so not sure how helpful this will be. You can find it at: https://try.gitea.io/testing_account/uvt-1224

@zeripath
Copy link
Contributor

zeripath commented May 5, 2022

@prologic

Please could you give the link for the reproducer on try.gitea.io

I'm sorry I don't have time to reproduce on a "demo" instance. The bug is quite clear, you have a full traceback. I even gave you a point in time where the regression occurred. At this point I can probably easily rollback to 1.16.5

Your report said you were able to reproduce it on try. That's why I phrased my comment the way I did.

Although the panic is very helpful and I think I know how to fix it from that - it's always best to give us a concise reproducer or method for reproducing the problem. My guess from the panic and the logs is that you are looking at a compare page when you're not logged in?

If so then my proposed PR will fix this. If not whilst the PR will prevent that panic there's likely another bug.

@zeripath
Copy link
Contributor

zeripath commented May 5, 2022

@number42net

I encountered it while running a migration, I tried cloning the last repo I worked on before getting the error. Initially I got an 500 error on the repo page, but that's gone after refreshing, so not sure how helpful this will be. You can find it at: https://try.gitea.io/testing_account/uvt-1224

I am suspicious that this is not the same bug if it was during a migration. We'd need to see your logs to see if it's the same.

@number42net
Copy link

number42net commented May 5, 2022

Here is a copy of the log:

Server listening on :: port 22.
Server listening on 0.0.0.0 port 22.
2022/05/05 20:06:24 cmd/web.go:102:runWeb() [I] Starting Gitea on PID: 16
2022/05/05 20:06:24 cmd/web.go:150:runWeb() [I] Global init
2022/05/05 20:06:24 routers/init.go:107:GlobalInitInstalled() [I] Git Version: 2.30.3, Wire Protocol Version 2 Enabled
2022/05/05 20:06:24 routers/init.go:110:GlobalInitInstalled() [I] AppPath: /usr/local/bin/gitea
2022/05/05 20:06:24 routers/init.go:111:GlobalInitInstalled() [I] AppWorkPath: /app/gitea
2022/05/05 20:06:24 routers/init.go:112:GlobalInitInstalled() [I] Custom path: /data/gitea
2022/05/05 20:06:24 routers/init.go:113:GlobalInitInstalled() [I] Log path: /data/gitea/log
2022/05/05 20:06:24 routers/init.go:114:GlobalInitInstalled() [I] Configuration file: /data/gitea/conf/app.ini
2022/05/05 20:06:24 routers/init.go:115:GlobalInitInstalled() [I] Run Mode: Prod
2022/05/05 20:06:24 ...dules/setting/log.go:287:newLogService() [I] Gitea v1.16.7 built with GNU Make 4.3, go1.18.1 : bindata, timetzdata, sqlite, sqlite_unlock_notify
2022/05/05 20:06:24 ...dules/setting/log.go:334:newLogService() [I] Gitea Log Mode: Console(Console:)
2022/05/05 20:06:24 ...dules/setting/log.go:250:generateNamedLogger() [I] Router Log: Console(console:)
2022/05/05 20:06:24 ...les/setting/cache.go:78:newCacheService() [I] Cache Service Enabled
2022/05/05 20:06:24 ...les/setting/cache.go:93:newCacheService() [I] Last Commit Cache Service Enabled
2022/05/05 20:06:24 ...s/setting/session.go:75:newSessionService() [I] Session Service Enabled
2022/05/05 20:06:24 ...s/storage/storage.go:171:initAttachments() [I] Initialising Attachment storage with type:
2022/05/05 20:06:24 ...les/storage/local.go:46:NewLocalStorage() [I] Creating new Local Storage at /data/gitea/attachments
2022/05/05 20:06:24 ...s/storage/storage.go:165:initAvatars() [I] Initialising Avatar storage with type:
2022/05/05 20:06:24 ...les/storage/local.go:46:NewLocalStorage() [I] Creating new Local Storage at /data/gitea/avatars
2022/05/05 20:06:24 ...s/storage/storage.go:183:initRepoAvatars() [I] Initialising Repository Avatar storage with type:
2022/05/05 20:06:24 ...les/storage/local.go:46:NewLocalStorage() [I] Creating new Local Storage at /data/gitea/repo-avatars
2022/05/05 20:06:24 ...s/storage/storage.go:177:initLFS() [I] Initialising LFS storage with type:
2022/05/05 20:06:24 ...les/storage/local.go:46:NewLocalStorage() [I] Creating new Local Storage at /data/git/lfs
2022/05/05 20:06:24 ...s/storage/storage.go:189:initRepoArchives() [I] Initialising Repository Archive storage with type:
2022/05/05 20:06:24 ...les/storage/local.go:46:NewLocalStorage() [I] Creating new Local Storage at /data/gitea/repo-archive
2022/05/05 20:06:24 ...eue/queue_wrapped.go:73:setInternal() [W] [Attempt: 1] Failed to create queue: level for push_update cfg: queue.LevelQueueConfiguration{ByteFIFOQueueConfiguration:queue.ByteFIFOQueueConfiguration{WorkerPoolConfiguration:queue.WorkerPoolConfiguration{QueueLength:20, BatchLength:20, BlockTimeout:1000000000, BoostTimeout:300000000000, BoostWorkers:1, MaxWorkers:5}, Workers:0, Name:"push_update-level", WaitOnEmpty:false}, DataDir:"/data/gitea/queues/common", ConnectionString:"", QueueName:""} error: unable to lock level db at /data/gitea/queues/common: resource temporarily unavailable
2022/05/05 20:06:24 ...eue/queue_wrapped.go:73:setInternal() [W] [Attempt: 1] Failed to create queue: level for notification-service cfg: queue.LevelQueueConfiguration{ByteFIFOQueueConfiguration:queue.ByteFIFOQueueConfiguration{WorkerPoolConfiguration:queue.WorkerPoolConfiguration{QueueLength:20, BatchLength:20, BlockTimeout:1000000000, BoostTimeout:300000000000, BoostWorkers:1, MaxWorkers:5}, Workers:0, Name:"notification-service-level", WaitOnEmpty:false}, DataDir:"/data/gitea/queues/common", ConnectionString:"", QueueName:""} error: unable to lock level db at /data/gitea/queues/common: resource temporarily unavailable
2022/05/05 20:06:24 ...eue/queue_wrapped.go:73:setInternal() [W] [Attempt: 1] Failed to create queue: unique-level for repo-archive cfg: queue.LevelUniqueQueueConfiguration{ByteFIFOQueueConfiguration:queue.ByteFIFOQueueConfiguration{WorkerPoolConfiguration:queue.WorkerPoolConfiguration{QueueLength:20, BatchLength:20, BlockTimeout:1000000000, BoostTimeout:300000000000, BoostWorkers:1, MaxWorkers:5}, Workers:0, Name:"repo-archive-level", WaitOnEmpty:false}, DataDir:"/data/gitea/queues/common", ConnectionString:"", QueueName:""} error: unable to lock level db at /data/gitea/queues/common: resource temporarily unavailable
2022/05/05 20:06:24 routers/init.go:131:GlobalInitInstalled() [I] SQLite3 support is enabled
2022/05/05 20:06:24 routers/common/db.go:20:InitDBEngine() [I] Beginning ORM engine initialization.
2022/05/05 20:06:24 routers/common/db.go:27:InitDBEngine() [I] ORM engine initialization attempt #1/10...
2022/05/05 20:06:24 cmd/web.go:153:runWeb() [I] PING DATABASE mysql
2022/05/05 20:06:25 cmd/web.go:153:runWeb() [W] Table project column board_type db type is INT(10) UNSIGNED, struct type is INT UNSIGNED
2022/05/05 20:06:25 cmd/web.go:153:runWeb() [W] Table project column type db type is INT(10) UNSIGNED, struct type is INT UNSIGNED
2022/05/05 20:06:25 routers/init.go:137:GlobalInitInstalled() [I] ORM engine initialization successful!
2022/05/05 20:06:25 ...les/queue/setting.go:53:CreateQueue() [W] Unable to create queue for issue_indexer: unable to lock level db at /data/gitea/queues/common: resource temporarily unavailable
2022/05/05 20:06:25 ...les/queue/setting.go:54:CreateQueue() [W] Attempting to create wrapped queue
2022/05/05 20:06:25 ...er/issues/indexer.go:144:func2() [I] PID 16: Initializing Issue Indexer: bleve
2022/05/05 20:06:25 ...xer/stats/indexer.go:39:populateRepoIndexer() [I] Populating the repo stats indexer with existing repositories
2022/05/05 20:06:25 ...eue/queue_wrapped.go:73:setInternal() [W] [Attempt: 1] Failed to create queue: unique-level for repo_stats_update cfg: queue.LevelUniqueQueueConfiguration{ByteFIFOQueueConfiguration:queue.ByteFIFOQueueConfiguration{WorkerPoolConfiguration:queue.WorkerPoolConfiguration{QueueLength:20, BatchLength:20, BlockTimeout:1000000000, BoostTimeout:300000000000, BoostWorkers:1, MaxWorkers:5}, Workers:0, Name:"repo_stats_update-level", WaitOnEmpty:false}, DataDir:"/data/gitea/queues/common", ConnectionString:"", QueueName:""} error: unable to lock level db at /data/gitea/queues/common: resource temporarily unavailable
2022/05/05 20:06:25 ...xer/stats/indexer.go:85:populateRepoIndexer() [I] Done (re)populating the repo stats indexer with existing repositories
2022/05/05 20:06:25 ...eue/queue_wrapped.go:73:setInternal() [W] [Attempt: 1] Failed to create queue: unique-level for mirror cfg: queue.LevelUniqueQueueConfiguration{ByteFIFOQueueConfiguration:queue.ByteFIFOQueueConfiguration{WorkerPoolConfiguration:queue.WorkerPoolConfiguration{QueueLength:1000, BatchLength:20, BlockTimeout:1000000000, BoostTimeout:300000000000, BoostWorkers:1, MaxWorkers:5}, Workers:0, Name:"mirror-level", WaitOnEmpty:false}, DataDir:"/data/gitea/queues/common", ConnectionString:"", QueueName:""} error: unable to lock level db at /data/gitea/queues/common: resource temporarily unavailable
2022/05/05 20:06:25 ...eue/queue_wrapped.go:73:setInternal() [W] [Attempt: 1] Failed to create queue: unique-level for pr_patch_checker cfg: queue.LevelUniqueQueueConfiguration{ByteFIFOQueueConfiguration:queue.ByteFIFOQueueConfiguration{WorkerPoolConfiguration:queue.WorkerPoolConfiguration{QueueLength:1000, BatchLength:20, BlockTimeout:1000000000, BoostTimeout:300000000000, BoostWorkers:1, MaxWorkers:5}, Workers:0, Name:"pr_patch_checker-level", WaitOnEmpty:false}, DataDir:"/data/gitea/queues/common", ConnectionString:"", QueueName:""} error: unable to lock level db at /data/gitea/queues/common: resource temporarily unavailable
2022/05/05 20:06:25 ...eue/queue_wrapped.go:73:setInternal() [W] [Attempt: 1] Failed to create queue: level for task cfg: queue.LevelQueueConfiguration{ByteFIFOQueueConfiguration:queue.ByteFIFOQueueConfiguration{WorkerPoolConfiguration:queue.WorkerPoolConfiguration{QueueLength:1000, BatchLength:20, BlockTimeout:1000000000, BoostTimeout:300000000000, BoostWorkers:1, MaxWorkers:5}, Workers:0, Name:"task-level", WaitOnEmpty:false}, DataDir:"/data/gitea/queues/common", ConnectionString:"", QueueName:""} error: unable to lock level db at /data/gitea/queues/common: resource temporarily unavailable
2022/05/05 20:06:25 ...er/issues/indexer.go:223:func3() [I] Issue Indexer Initialization took 339.275414ms
2022/05/05 20:06:26 cmd/web.go:208:listen() [I] Listen: http://0.0.0.0:3000
2022/05/05 20:06:26 cmd/web.go:212:listen() [I] AppURL(ROOT_URL): https://gitea.#####.com/
2022/05/05 20:06:26 cmd/web.go:215:listen() [I] LFS server enabled
2022/05/05 20:06:26 ...s/graceful/server.go:61:NewServer() [I] Starting new Web server: tcp:0.0.0.0:3000 on PID: 16
2022/05/05 20:06:46 Started GET / for 10.###.###.###:0
2022/05/05 20:06:46 routers/web/base.go:130:1() [E] PANIC: runtime error: invalid memory address or nil pointer dereference
/usr/local/go/src/runtime/panic.go:220 (0x457635)
/usr/local/go/src/runtime/signal_unix.go:818 (0x457605)
/go/src/code.gitea.io/gitea/routers/web/feed/profile.go:37 (0x1fbb59c)
/go/src/code.gitea.io/gitea/routers/web/user/home.go:134 (0x1fd20d2)
/go/src/code.gitea.io/gitea/routers/web/home.go:41 (0x2034770)
/go/src/code.gitea.io/gitea/modules/web/route.go:74 (0x1e47d44)
/usr/local/go/src/net/http/server.go:2084 (0x7ac6ce)
/go/pkg/mod/github.com/go-chi/chi/v5@v5.0.7/mux.go:442 (0x1656dd5)
/usr/local/go/src/net/http/server.go:2084 (0x7ac6ce)
/go/src/code.gitea.io/gitea/modules/web/route.go:113 (0x1e48531)
/usr/local/go/src/net/http/server.go:2084 (0x7ac6ce)
/go/src/code.gitea.io/gitea/modules/web/route.go:113 (0x1e48531)
/usr/local/go/src/net/http/server.go:2084 (0x7ac6ce)
/go/src/code.gitea.io/gitea/modules/web/route.go:113 (0x1e48531)
/usr/local/go/src/net/http/server.go:2084 (0x7ac6ce)
/go/pkg/mod/github.com/go-chi/chi/v5@v5.0.7/middleware/get_head.go:37 (0x1e77de4)
/usr/local/go/src/net/http/server.go:2084 (0x7ac6ce)
/go/src/code.gitea.io/gitea/modules/web/route.go:113 (0x1e48531)
/usr/local/go/src/net/http/server.go:2084 (0x7ac6ce)
/go/src/code.gitea.io/gitea/modules/context/context.go:745 (0x1668786)
/usr/local/go/src/net/http/server.go:2084 (0x7ac6ce)
/go/pkg/mod/github.com/go-chi/chi/v5@v5.0.7/mux.go:71 (0x1654c0c)
/go/pkg/mod/github.com/go-chi/chi/v5@v5.0.7/mux.go:314 (0x16565bb)
/usr/local/go/src/net/http/server.go:2084 (0x7ac6ce)
/go/pkg/mod/github.com/go-chi/chi/v5@v5.0.7/mux.go:442 (0x1656dd5)
/usr/local/go/src/net/http/server.go:2084 (0x7ac6ce)
/go/src/code.gitea.io/gitea/routers/web/base.go:169 (0x20332d1)
/usr/local/go/src/net/http/server.go:2084 (0x7ac6ce)
/go/pkg/mod/gitea.com/go-chi/session@v0.0.0-20211218221615-e3605d8b28b8/session.go:257 (0x146137d)
/usr/local/go/src/net/http/server.go:2084 (0x7ac6ce)
/go/src/code.gitea.io/gitea/modules/public/public.go:42 (0x15949db)
/usr/local/go/src/net/http/server.go:2084 (0x7ac6ce)
/go/pkg/mod/github.com/go-chi/chi/v5@v5.0.7/mux.go:71 (0x1654c0c)
/go/pkg/mod/github.com/go-chi/chi/v5@v5.0.7/mux.go:314 (0x16565bb)
/usr/local/go/src/net/http/server.go:2084 (0x7ac6ce)
/go/pkg/mod/github.com/go-chi/chi/v5@v5.0.7/mux.go:442 (0x1656dd5)
/usr/local/go/src/net/http/server.go:2084 (0x7ac6ce)
/go/src/code.gitea.io/gitea/routers/common/middleware.go:78 (0x1e7dfc1)
/usr/local/go/src/net/http/server.go:2084 (0x7ac6ce)
/go/src/code.gitea.io/gitea/routers/common/logger.go:23 (0x1e7d24f)
/usr/local/go/src/net/http/server.go:2084 (0x7ac6ce)
/go/pkg/mod/github.com/go-chi/chi/v5@v5.0.7/middleware/strip.go:30 (0x1e7ab58)
/usr/local/go/src/net/http/server.go:2084 (0x7ac6ce)
/go/pkg/mod/github.com/chi-middleware/proxy@v1.1.1/middleware.go:37 (0x1e77456)
/usr/local/go/src/net/http/server.go:2084 (0x7ac6ce)
/go/src/code.gitea.io/gitea/routers/common/middleware.go:31 (0x1e7de19)
/usr/local/go/src/net/http/server.go:2084 (0x7ac6ce)
/go/pkg/mod/github.com/go-chi/chi/v5@v5.0.7/mux.go:88 (0x1654bc1)
/go/src/code.gitea.io/gitea/modules/web/route.go:328 (0x1e4b38d)
/usr/local/go/src/net/http/server.go:2916 (0x7afcba)
/usr/local/go/src/net/http/server.go:1966 (0x7ab176)
/usr/local/go/src/runtime/asm_amd64.s:1571 (0x4745a0)
2022/05/05 20:06:46 Completed GET / 500 Internal Server Error in 89.209894ms

The migration consists of pushing cloned repo's from GitHub into Gitea, the repo's are created using the API and data transferred using Git https.

Now that I have migrated a few more repo's, the 500 error on the landing page is gone. Presumably because whatever was causing it is not longer shown on it.

@prologic
Copy link
Author

prologic commented May 6, 2022

Your report said you were able to reproduce it on try. That's why I phrased my comment the way I did.

Oh I'm sorry! That was a mistake on my part 😅 I guess that option needs a "N/A" really. Sorry about that!

There is no real repdocuer here anyway, as it seems it's web crawlers that are triggering this on my instance. In other words, there is nothing specific I or any of my users that use my instance are doing to trigger the bug.

@prologic
Copy link
Author

prologic commented May 6, 2022

Also many thanks for fixing this so quickly! 🙏 I've just been "ignoring" the alert/alarms firing for the moment (as it's not causing any other significant impact)

wxiaoguang added a commit that referenced this issue May 6, 2022
CheckRepoUnitUser should tolerate nil users.

Fix #19613

Signed-off-by: Andrew Thornton <art27@cantab.net>

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
@wxiaoguang
Copy link
Contributor

wxiaoguang commented May 6, 2022

Reopen to wait for backport

@wxiaoguang wxiaoguang reopened this May 6, 2022
zeripath added a commit to zeripath/gitea that referenced this issue May 6, 2022
Backport go-gitea#19625

CheckRepoUnitUser should tolerate nil users.

Fix go-gitea#19613

Signed-off-by: Andrew Thornton <art27@cantab.net>

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
@zeripath
Copy link
Contributor

zeripath commented May 6, 2022

@number42net that stacktrace indicates this is a completely different bug so I will open another issue for that.

wxiaoguang added a commit that referenced this issue May 6, 2022
)

Backport #19625

CheckRepoUnitUser should tolerate nil users.

Fix #19613

Signed-off-by: Andrew Thornton <art27@cantab.net>

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
@wxiaoguang
Copy link
Contributor

The major issue has been fixed by #19625 #19630

The other issue has been recorded in #19631

🎉

@prologic
Copy link
Author

prologic commented May 6, 2022

Nice work! 🥳🙇‍♀️

AbdulrhmnGhanem pushed a commit to kitspace/gitea that referenced this issue Aug 24, 2022
CheckRepoUnitUser should tolerate nil users.

Fix go-gitea#19613

Signed-off-by: Andrew Thornton <art27@cantab.net>

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
@go-gitea go-gitea locked and limited conversation to collaborators May 3, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
issue/confirmed Issue has been reviewed and confirmed to be present or accepted to be implemented type/bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants