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

web.go PANIC on upgrade from 1.20.6 to 1.21 #28705

Closed
sysnux opened this issue Jan 5, 2024 · 3 comments · Fixed by #28708
Closed

web.go PANIC on upgrade from 1.20.6 to 1.21 #28705

sysnux opened this issue Jan 5, 2024 · 3 comments · Fixed by #28708
Labels
issue/workaround it is or has a workaround type/bug
Milestone

Comments

@sysnux
Copy link

sysnux commented Jan 5, 2024

Description

Trying to upgrade from 1.20.6 to 1.21.3 or 1.21.0, service won't start:

systemd[1]: Started gitea.service - Gitea.
gitea[62328]: 2024/01/05 09:51:31 cmd/web.go:242:runWeb() [I] Starting Gitea on PID: 62328
gitea[62328]: 2024/01/05 09:51:31 cmd/web.go:111:showWebStartupMessage() [I] Gitea version: 1.21.0 built with GNU Make 4.3, go1.21.4 : bindata, sqlite, sqlite_unlock_notify
gitea[62328]: 2024/01/05 09:51:31 cmd/web.go:112:showWebStartupMessage() [I] * RunMode: prod
gitea[62328]: 2024/01/05 09:51:31 cmd/web.go:113:showWebStartupMessage() [I] * AppPath: /usr/local/bin/gitea
gitea[62328]: 2024/01/05 09:51:31 cmd/web.go:114:showWebStartupMessage() [I] * WorkPath: /var/lib/gitea
gitea[62328]: 2024/01/05 09:51:31 cmd/web.go:115:showWebStartupMessage() [I] * CustomPath: /var/lib/gitea/custom
gitea[62328]: 2024/01/05 09:51:31 cmd/web.go:116:showWebStartupMessage() [I] * ConfigFile: /etc/gitea/app.ini
gitea[62328]: 2024/01/05 09:51:31 cmd/web.go:117:showWebStartupMessage() [I] Prepare to run web server
gitea[62328]: 2024/01/05 09:51:31 routers/init.go:112:InitWebInstalled() [I] Git version: 2.43.0, Wire Protocol Version 2 Enabled (home: /var/lib/gitea/data/home)
gitea[62328]: 2024/01/05 09:51:31 ...les/setting/cache.go:75:loadCacheFrom() [I] Cache Service Enabled
gitea[62328]: 2024/01/05 09:51:31 ...les/setting/cache.go:90:loadCacheFrom() [I] Last Commit Cache Service Enabled
gitea[62328]: 2024/01/05 09:51:31 ...s/setting/session.go:74:loadSessionFrom() [I] Session Service Enabled
gitea[62328]: 2024/01/05 09:51:31 ...es/setting/mailer.go:237:loadMailerFrom() [I] Mail Service Enabled
gitea[62328]: 2024/01/05 09:51:31 ...es/setting/mailer.go:259:loadNotifyMailFrom() [I] Notify Mail Service Enabled
gitea[62328]: 2024/01/05 09:51:31 ...s/storage/storage.go:176:initAttachments() [I] Initialising Attachment storage with type: local
gitea[62328]: 2024/01/05 09:51:31 ...les/storage/local.go:33:NewLocalStorage() [I] Creating new Local Storage at /var/lib/gitea/data/attachments
gitea[62328]: 2024/01/05 09:51:31 ...s/storage/storage.go:166:initAvatars() [I] Initialising Avatar storage with type: local
gitea[62328]: 2024/01/05 09:51:31 ...les/storage/local.go:33:NewLocalStorage() [I] Creating new Local Storage at /var/lib/gitea/data/avatars
gitea[62328]: 2024/01/05 09:51:31 ...s/storage/storage.go:192:initRepoAvatars() [I] Initialising Repository Avatar storage with type: local
gitea[62328]: 2024/01/05 09:51:31 ...les/storage/local.go:33:NewLocalStorage() [I] Creating new Local Storage at /var/lib/gitea/data/repo-avatars
gitea[62328]: 2024/01/05 09:51:31 ...s/storage/storage.go:198:initRepoArchives() [I] Initialising Repository Archive storage with type: local
gitea[62328]: 2024/01/05 09:51:31 ...les/storage/local.go:33:NewLocalStorage() [I] Creating new Local Storage at /var/lib/gitea/data/repo-archive
gitea[62328]: 2024/01/05 09:51:31 ...s/storage/storage.go:208:initPackages() [I] Initialising Packages storage with type: local
gitea[62328]: 2024/01/05 09:51:31 ...les/storage/local.go:33:NewLocalStorage() [I] Creating new Local Storage at /var/lib/gitea/data/packages
gitea[62328]: 2024/01/05 09:51:31 ...s/storage/storage.go:219:initActions() [I] Initialising Actions storage with type: local
gitea[62328]: 2024/01/05 09:51:31 ...les/storage/local.go:33:NewLocalStorage() [I] Creating new Local Storage at /var/lib/gitea/data/actions_log
gitea[62328]: 2024/01/05 09:51:31 ...s/storage/storage.go:223:initActions() [I] Initialising ActionsArtifacts storage with type: local
gitea[62328]: 2024/01/05 09:51:31 ...les/storage/local.go:33:NewLocalStorage() [I] Creating new Local Storage at /var/lib/gitea/data/actions_artifacts
gitea[62328]: 2024/01/05 09:51:31 ...queue/workergroup.go:255:doRun() [D] Queue "notification-service" starts running
gitea[62328]: 2024/01/05 09:51:31 ...queue/workergroup.go:255:doRun() [D] Queue "mail" starts running
gitea[62328]: 2024/01/05 09:51:31 ...queue/workergroup.go:255:doRun() [D] Queue "repo-archive" starts running
gitea[62328]: 2024/01/05 09:51:31 routers/init.go:131:InitWebInstalled() [I] SQLite3 support is enabled
gitea[62328]: 2024/01/05 09:51:31 routers/common/db.go:23:InitDBEngine() [I] Beginning ORM engine initialization.
gitea[62328]: 2024/01/05 09:51:31 routers/common/db.go:30:InitDBEngine() [I] ORM engine initialization attempt #1/10...
gitea[62328]: 2024/01/05 09:51:31 ...queue/workergroup.go:333:doRun() [D] Queue "notification-service" is shutting down
gitea[62328]: 2024/01/05 09:51:31 ...queue/workergroup.go:333:doRun() [D] Queue "mail" is shutting down
gitea[62328]: 2024/01/05 09:51:31 ...queue/workergroup.go:334:doRun() [D] Queue "notification-service" stops running
gitea[62328]: 2024/01/05 09:51:31 ...queue/workergroup.go:333:doRun() [D] Queue "repo-archive" is shutting down
gitea[62328]: 2024/01/05 09:51:31 ...queue/workergroup.go:334:doRun() [D] Queue "mail" stops running
gitea[62328]: 2024/01/05 09:51:31 ...queue/workergroup.go:334:doRun() [D] Queue "repo-archive" stops running
gitea[62328]: 2024/01/05 09:51:31 ...eful/manager_unix.go:208:handleSignals() [W] PID: 62328. Background context for manager closed - context canceled - Shutting down...
gitea[62328]: 2024/01/05 09:51:31 cmd/web.go:231:func1() [F] PANIC: runtime error: index out of range [0] with length 0
gitea[62328]: /usr/local/go/src/runtime/panic.go:114 (0x43b09b)
gitea[62328]: /source/modules/setting/database.go:171 (0xa59e37)
gitea[62328]: /source/modules/setting/database.go:112 (0xa5982b)
gitea[62328]: /source/models/db/engine.go:97 (0xfc7a36)
gitea[62328]: /source/models/db/engine.go:134 (0xfc7ce8)
gitea[62328]: /source/models/db/engine.go:180 (0xfc81a5)
gitea[62328]: /source/routers/common/db.go:31 (0x24109e4)
gitea[62328]: /source/routers/init.go:65 (0x272a80e)
gitea[62328]: /source/routers/init.go:136 (0x272aed8)
gitea[62328]: /source/cmd/web.go:194 (0x282b038)
gitea[62328]: /source/cmd/web.go:262 (0x282b5fc)
gitea[62328]: /source/cmd/main.go:117 (0x28220cb)
gitea[62328]: /go/pkg/mod/github.com/urfave/cli/[email protected]/command.go:274 (0x13440d7)
gitea[62328]: /go/pkg/mod/github.com/urfave/cli/[email protected]/command.go:267 (0x1344324)
gitea[62328]: /go/pkg/mod/github.com/urfave/cli/[email protected]/app.go:332 (0x1340a56)
gitea[62328]: /go/pkg/mod/github.com/urfave/cli/[email protected]/app.go:309 (0x2822cd8)
gitea[62328]: /source/cmd/main.go:176 (0x2822cbc)
gitea[62328]: /source/main.go:46 (0x2868d58)
gitea[62328]: /usr/local/go/src/runtime/proc.go:267 (0x4400ba)
gitea[62328]: /usr/local/go/src/runtime/asm_amd64.s:1650 (0x473ca0)
systemd[1]: gitea.service: Main process exited, code=exited, status=1/FAILURE
systemd[1]: gitea.service: Failed with result 'exit-code'.

Reverting to 1.20.6 afterwards works fine.

Gitea Version

1.21.0

Can you reproduce the bug on the Gitea demo site?

No

Log Gist

No response

Screenshots

No response

Git Version

2.43.0

Operating System

Linux Fedora 38

How are you running Gitea?

Running the binary (gitea-1.21.0-linux-amd64 or gitea-1.21.3-linux-amd64), with PostgreSQL (14.10) database.

Database

PostgreSQL

@sysnux sysnux added the type/bug label Jan 5, 2024
@wxiaoguang
Copy link
Contributor

Regression of #27723

What's your [database] section of the app.ini? Maybe you could try to bypass it by setting a host name for the HOST config.

@wxiaoguang
Copy link
Contributor

-> Fix panic when parsing empty pgsql host #28708

@wxiaoguang wxiaoguang added the issue/workaround it is or has a workaround label Jan 6, 2024
@sysnux
Copy link
Author

sysnux commented Jan 6, 2024

Setting HOST = /var/run/postgresql/ indeed solved the problem. 1.21.3 is running fine now.
The docs are still a bit confusing though. I initially configured HOST = /var/run/postgresql/.s.PGSQL.5432, and got:
routers/init.go:69:mustInitCtx() [F] code.gitea.io/gitea/routers/common.InitDBEngine(ctx) failed: dial unix /var/run/postgresql/.s.PGSQL.5432/.s.PGSQL.5432: connect: not a directory

Thanks for very prompt resolution!

GiteaBot pushed a commit to GiteaBot/gitea that referenced this issue Jan 6, 2024
lunny pushed a commit that referenced this issue Jan 6, 2024
@lunny lunny added this to the 1.21.4 milestone Jan 6, 2024
wxiaoguang added a commit that referenced this issue Jan 6, 2024
Backport #28708 by wxiaoguang

Regression of #27723
Fix #28705

Co-authored-by: wxiaoguang <[email protected]>
fuxiaohei pushed a commit to fuxiaohei/gitea that referenced this issue Jan 17, 2024
silverwind pushed a commit to silverwind/gitea that referenced this issue Feb 20, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 21, 2024
project-mirrors-bot-tu bot pushed a commit to project-mirrors/forgejo-as-gitea-fork that referenced this issue Jan 23, 2025
)

Backport go-gitea#28708 by wxiaoguang

Regression of go-gitea#27723
Fix go-gitea#28705

Co-authored-by: wxiaoguang <[email protected]>
(cherry picked from commit 7f833d8)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
issue/workaround it is or has a workaround type/bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants