go-gitea / gitea

Git with a cup of tea! Painless self-hosted all-in-one software development service, including Git hosting, code review, team collaboration, package registry and CI/CD
https://gitea.com
MIT License
44.44k stars 5.43k forks source link

1.21.11 MSSQL upgrade not working #31529

Closed katit closed 1 month ago

katit commented 3 months ago

Description

Upgrading by stopping service, replacing .exe with gitea-1.22.0-gogit-windows-4.0-amd64, restarting service. Gitea wouldn't start. DB - preexisting SQL Server 2019

Logs from start to end for failed start attempt. I feel like config options changes? Or maybe how MSSQL connection happens changed?

[database] DB_TYPE = mssql HOST = 192.168.3.3\SQLSERVER2019:1433 NAME = Gitea USER = Gitea PASSWD = Gitea SSL_MODE = disable LOG_SQL = true

Logs:

2024/06/29 19:23:48 ...s/setting/session.go:77:loadSessionFrom() [I] Session Service Enabled 2024/06/29 19:23:48 ...es/setting/mailer.go:237:loadMailerFrom() [I] Mail Service Enabled 2024/06/29 19:23:48 ...es/setting/mailer.go:259:loadNotifyMailFrom() [I] Notify Mail Service Enabled 2024/06/29 19:23:48 ...s/storage/storage.go:176:initAttachments() [I] Initialising Attachment storage with type: local 2024/06/29 19:23:48 ...les/storage/local.go:33:NewLocalStorage() [I] Creating new Local Storage at C:\Program Files\Gitea\data\attachments 2024/06/29 19:23:48 ...s/storage/storage.go:166:initAvatars() [I] Initialising Avatar storage with type: local 2024/06/29 19:23:48 ...les/storage/local.go:33:NewLocalStorage() [I] Creating new Local Storage at C:\Program Files\Gitea\data\avatars 2024/06/29 19:23:48 ...s/storage/storage.go:192:initRepoAvatars() [I] Initialising Repository Avatar storage with type: local 2024/06/29 19:23:48 ...les/storage/local.go:33:NewLocalStorage() [I] Creating new Local Storage at C:\Program Files\Gitea\data\repo-avatars 2024/06/29 19:23:48 ...s/storage/storage.go:186:initLFS() [I] Initialising LFS storage with type: local 2024/06/29 19:23:48 ...les/storage/local.go:33:NewLocalStorage() [I] Creating new Local Storage at C:\Program Files\Gitea\data\lfs 2024/06/29 19:23:48 ...s/storage/storage.go:198:initRepoArchives() [I] Initialising Repository Archive storage with type: local 2024/06/29 19:23:48 ...les/storage/local.go:33:NewLocalStorage() [I] Creating new Local Storage at C:\Program Files\Gitea\data\repo-archive 2024/06/29 19:23:48 ...s/storage/storage.go:208:initPackages() [I] Initialising Packages storage with type: local 2024/06/29 19:23:48 ...les/storage/local.go:33:NewLocalStorage() [I] Creating new Local Storage at C:\Program Files\Gitea\data\packages 2024/06/29 19:23:48 ...s/storage/storage.go:219:initActions() [I] Initialising Actions storage with type: local 2024/06/29 19:23:48 ...les/storage/local.go:33:NewLocalStorage() [I] Creating new Local Storage at C:\Program Files\Gitea\data\actions_log 2024/06/29 19:23:48 ...s/storage/storage.go:223:initActions() [I] Initialising ActionsArtifacts storage with type: local 2024/06/29 19:23:48 ...les/storage/local.go:33:NewLocalStorage() [I] Creating new Local Storage at C:\Program Files\Gitea\data\actions_artifacts 2024/06/29 19:23:48 ...queue/workergroup.go:271:doRun() [D] Queue "mail" starts running 2024/06/29 19:23:48 ...queue/workergroup.go:271:doRun() [D] Queue "notification-service" starts running 2024/06/29 19:23:48 ...queue/workergroup.go:271:doRun() [D] Queue "repo-archive" starts running 2024/06/29 19:23:48 routers/init.go:138:InitWebInstalled() [I] SQLite3 support is enabled 2024/06/29 19:23:48 routers/common/db.go:23:InitDBEngine() [I] Beginning ORM engine initialization. 2024/06/29 19:23:48 routers/common/db.go:30:InitDBEngine() [I] ORM engine initialization attempt #1/10... 2024/06/29 19:23:48 cmd/web.go:194:serveInstalled() [I] PING DATABASE mssql 2024/06/29 19:23:48 routers/common/db.go:36:InitDBEngine() [E] ORM engine initialization attempt #1/10 failed. Error: mssql: login error: Login failed for user 'Gitea'. 2024/06/29 19:23:48 routers/common/db.go:37:InitDBEngine() [I] Backing off for 3 seconds 2024/06/29 19:23:51 routers/common/db.go:30:InitDBEngine() [I] ORM engine initialization attempt #2/10... 2024/06/29 19:23:51 cmd/web.go:194:serveInstalled() [I] PING DATABASE mssql 2024/06/29 19:23:51 routers/common/db.go:36:InitDBEngine() [E] ORM engine initialization attempt #2/10 failed. Error: mssql: login error: Login failed for user 'Gitea'. 2024/06/29 19:23:51 routers/common/db.go:37:InitDBEngine() [I] Backing off for 3 seconds 2024/06/29 19:23:54 routers/common/db.go:30:InitDBEngine() [I] ORM engine initialization attempt #3/10... 2024/06/29 19:23:54 cmd/web.go:194:serveInstalled() [I] PING DATABASE mssql 2024/06/29 19:23:54 routers/common/db.go:36:InitDBEngine() [E] ORM engine initialization attempt #3/10 failed. Error: mssql: login error: Login failed for user 'Gitea'. 2024/06/29 19:23:54 routers/common/db.go:37:InitDBEngine() [I] Backing off for 3 seconds 2024/06/29 19:23:57 routers/common/db.go:30:InitDBEngine() [I] ORM engine initialization attempt #4/10... 2024/06/29 19:23:57 cmd/web.go:194:serveInstalled() [I] PING DATABASE mssql 2024/06/29 19:23:57 routers/common/db.go:36:InitDBEngine() [E] ORM engine initialization attempt #4/10 failed. Error: mssql: login error: Login failed for user 'Gitea'. 2024/06/29 19:23:57 routers/common/db.go:37:InitDBEngine() [I] Backing off for 3 seconds 2024/06/29 19:24:00 routers/common/db.go:30:InitDBEngine() [I] ORM engine initialization attempt #5/10... 2024/06/29 19:24:00 cmd/web.go:194:serveInstalled() [I] PING DATABASE mssql 2024/06/29 19:24:00 routers/common/db.go:36:InitDBEngine() [E] ORM engine initialization attempt #5/10 failed. Error: mssql: login error: Login failed for user 'Gitea'. 2024/06/29 19:24:00 routers/common/db.go:37:InitDBEngine() [I] Backing off for 3 seconds 2024/06/29 19:24:03 routers/common/db.go:30:InitDBEngine() [I] ORM engine initialization attempt #6/10... 2024/06/29 19:24:03 cmd/web.go:194:serveInstalled() [I] PING DATABASE mssql 2024/06/29 19:24:03 routers/common/db.go:36:InitDBEngine() [E] ORM engine initialization attempt #6/10 failed. Error: mssql: login error: Login failed for user 'Gitea'. 2024/06/29 19:24:03 routers/common/db.go:37:InitDBEngine() [I] Backing off for 3 seconds 2024/06/29 19:24:06 routers/common/db.go:30:InitDBEngine() [I] ORM engine initialization attempt #7/10... 2024/06/29 19:24:06 cmd/web.go:194:serveInstalled() [I] PING DATABASE mssql 2024/06/29 19:24:06 routers/common/db.go:36:InitDBEngine() [E] ORM engine initialization attempt #7/10 failed. Error: mssql: login error: Login failed for user 'Gitea'. 2024/06/29 19:24:06 routers/common/db.go:37:InitDBEngine() [I] Backing off for 3 seconds 2024/06/29 19:24:09 routers/common/db.go:30:InitDBEngine() [I] ORM engine initialization attempt #8/10... 2024/06/29 19:24:09 cmd/web.go:194:serveInstalled() [I] PING DATABASE mssql 2024/06/29 19:24:09 routers/common/db.go:36:InitDBEngine() [E] ORM engine initialization attempt #8/10 failed. Error: mssql: login error: Login failed for user 'Gitea'. 2024/06/29 19:24:09 routers/common/db.go:37:InitDBEngine() [I] Backing off for 3 seconds 2024/06/29 19:24:12 routers/common/db.go:30:InitDBEngine() [I] ORM engine initialization attempt #9/10... 2024/06/29 19:24:12 cmd/web.go:194:serveInstalled() [I] PING DATABASE mssql 2024/06/29 19:24:12 routers/common/db.go:36:InitDBEngine() [E] ORM engine initialization attempt #9/10 failed. Error: mssql: login error: Login failed for user 'Gitea'. 2024/06/29 19:24:12 routers/common/db.go:37:InitDBEngine() [I] Backing off for 3 seconds 2024/06/29 19:24:15 routers/common/db.go:30:InitDBEngine() [I] ORM engine initialization attempt #10/10... 2024/06/29 19:24:15 cmd/web.go:194:serveInstalled() [I] PING DATABASE mssql 2024/06/29 19:24:15 routers/init.go:73:mustInitCtx() [F] code.gitea.io/gitea/routers/common.InitDBEngine(ctx) failed: mssql: login error: Login failed for user 'Gitea'.

Gitea Version

1.22

Can you reproduce the bug on the Gitea demo site?

No

Log Gist

No response

Screenshots

No response

Git Version

No response

Operating System

Windows Server 2022

How are you running Gitea?

Running via wrapping Gitea.exe into windows service per official instructions

Database

MSSQL

lunny commented 3 months ago

Looks like your login password is not right?

katit commented 3 months ago

No, I simply switch exe. This config works with 1.21.11 but doesn't work with 1.22

I "fixed" it by switching to "localhost" without named instance. So, the bug is in how sql connection string is parsed.

lunny commented 3 months ago

I don't know whether we have support the format of host.

HOST = 192.168.3.3\SQLSERVER2019:1433
katit commented 3 months ago

Well, in 1.21 it supports it for sure, in 1.22 it doesn't. So something definitely changed. In my case I got lucky because I host on same machine so I was able to change port. If Gitea was on different machine it would not work. I guess it needs to be checked how parsing of HOST is done and what is changed since 1.21?

techknowlogick commented 2 months ago

I think we upgraded the mssql lib we used between those two versions. We switched to the msft fork, and so probably that’s where we can start looking for debugging

GiteaBot commented 1 month ago

We close issues that need feedback from the author if there were no new comments for a month. :tea: