Gitea 1.16.4 to 1.17.1 upgrade and Windows service fails to start

Hello,

I’ve been using gitea on a windows server but i’m stuck with gitea release 1.16.4.
When i try to migrate to 1.17.1 i can’t run gitea as a windows service. I get an error.
I read somewhere service worker is disable by default since release 1.16.6.
Is it possible to run 1.17.1 as a windows service and could youu help me please ?

Thanks for your help

The service-workers you refer to are browser service-workers, they should have nothing to do with your windows server.

Please make sure you have done all steps listed here: Register as a Windows Service - Docs

To help you further, we would need exact error you’d get and maybe some parts of your logs (especially the lines generated at startup).

Hello,

I always use the doc about Register as Windows Service and it works for gitea up to 1.16.4.

Here are the logs, it looks like a database connection issue, weird

Thank you very much for your help.

2022/09/07 10:13:46 ...dules/setting/log.go:335:newLogService() [I] Gitea Log Mode: File(File:info)
2022/09/07 10:13:46 ...dules/setting/log.go:249:generateNamedLogger() [I] Router Log: Console(console:info)
2022/09/07 10:13:46 ...les/setting/cache.go:76:newCacheService() [I] Cache Service Enabled
2022/09/07 10:13:46 ...les/setting/cache.go:91:newCacheService() [I] Last Commit Cache Service Enabled
2022/09/07 10:13:46 ...s/setting/session.go:73:newSessionService() [I] Session Service Enabled
2022/09/07 10:13:46 ...es/setting/mailer.go:127:newMailService() [I] Mail Service Enabled
2022/09/07 10:13:46 ...s/storage/storage.go:176:initAttachments() [I] Initialising Attachment storage with type: 
2022/09/07 10:13:46 ...les/storage/local.go:46:NewLocalStorage() [I] Creating new Local Storage at D:\gitea\bin\data\attachments
2022/09/07 10:13:46 ...s/storage/storage.go:170:initAvatars() [I] Initialising Avatar storage with type: 
2022/09/07 10:13:46 ...les/storage/local.go:46:NewLocalStorage() [I] Creating new Local Storage at D:\gitea\bin\data\avatars
2022/09/07 10:13:46 ...s/storage/storage.go:188:initRepoAvatars() [I] Initialising Repository Avatar storage with type: 
2022/09/07 10:13:46 ...les/storage/local.go:46:NewLocalStorage() [I] Creating new Local Storage at D:\gitea\bin\data\repo-avatars
2022/09/07 10:13:46 ...s/storage/storage.go:182:initLFS() [I] Initialising LFS storage with type: 
2022/09/07 10:13:46 ...les/storage/local.go:46:NewLocalStorage() [I] Creating new Local Storage at D:/gitea/data/lfs
2022/09/07 10:13:46 ...s/storage/storage.go:194:initRepoArchives() [I] Initialising Repository Archive storage with type: 
2022/09/07 10:13:46 ...les/storage/local.go:46:NewLocalStorage() [I] Creating new Local Storage at D:\gitea\bin\data\repo-archive
2022/09/07 10:13:46 ...s/storage/storage.go:200:initPackages() [I] Initialising Packages storage with type: 
2022/09/07 10:13:46 ...les/storage/local.go:46:NewLocalStorage() [I] Creating new Local Storage at D:\gitea\bin\data\packages
2022/09/07 10:13:46 routers/init.go:130:GlobalInitInstalled() [I] SQLite3 support is enabled
2022/09/07 10:13:46 routers/common/db.go:20:InitDBEngine() [I] Beginning ORM engine initialization.
2022/09/07 10:13:46 routers/common/db.go:27:InitDBEngine() [I] ORM engine initialization attempt #1/10...
2022/09/07 10:13:46 cmd/web.go:160:runWeb() [I] PING DATABASE mssql
2022/09/07 10:13:46 routers/common/db.go:33:InitDBEngine() [E] ORM engine initialization attempt #1/10 failed. Error: TLS Handshake failed: tls: server selected unsupported protocol version 301
2022/09/07 10:13:46 routers/common/db.go:34:InitDBEngine() [I] Backing off for 3 seconds
2022/09/07 10:13:49 routers/common/db.go:27:InitDBEngine() [I] ORM engine initialization attempt #2/10...
2022/09/07 10:13:49 cmd/web.go:160:runWeb() [I] PING DATABASE mssql
2022/09/07 10:13:49 routers/common/db.go:33:InitDBEngine() [E] ORM engine initialization attempt #2/10 failed. Error: TLS Handshake failed: tls: server selected unsupported protocol version 301
2022/09/07 10:13:49 routers/common/db.go:34:InitDBEngine() [I] Backing off for 3 seconds
2022/09/07 10:13:52 routers/common/db.go:27:InitDBEngine() [I] ORM engine initialization attempt #3/10...
2022/09/07 10:13:52 cmd/web.go:160:runWeb() [I] PING DATABASE mssql
2022/09/07 10:13:52 routers/common/db.go:33:InitDBEngine() [E] ORM engine initialization attempt #3/10 failed. Error: TLS Handshake failed: tls: server selected unsupported protocol version 301
2022/09/07 10:13:52 routers/common/db.go:34:InitDBEngine() [I] Backing off for 3 seconds
2022/09/07 10:13:55 routers/common/db.go:27:InitDBEngine() [I] ORM engine initialization attempt #4/10...
2022/09/07 10:13:55 cmd/web.go:160:runWeb() [I] PING DATABASE mssql
2022/09/07 10:13:55 routers/common/db.go:33:InitDBEngine() [E] ORM engine initialization attempt #4/10 failed. Error: TLS Handshake failed: tls: server selected unsupported protocol version 301
2022/09/07 10:13:55 routers/common/db.go:34:InitDBEngine() [I] Backing off for 3 seconds
2022/09/07 10:13:58 routers/common/db.go:27:InitDBEngine() [I] ORM engine initialization attempt #5/10...
2022/09/07 10:13:58 cmd/web.go:160:runWeb() [I] PING DATABASE mssql
2022/09/07 10:13:58 routers/common/db.go:33:InitDBEngine() [E] ORM engine initialization attempt #5/10 failed. Error: TLS Handshake failed: tls: server selected unsupported protocol version 301
2022/09/07 10:13:58 routers/common/db.go:34:InitDBEngine() [I] Backing off for 3 seconds
2022/09/07 10:14:01 routers/common/db.go:27:InitDBEngine() [I] ORM engine initialization attempt #6/10...
2022/09/07 10:14:01 cmd/web.go:160:runWeb() [I] PING DATABASE mssql
2022/09/07 10:14:01 routers/common/db.go:33:InitDBEngine() [E] ORM engine initialization attempt #6/10 failed. Error: TLS Handshake failed: tls: server selected unsupported protocol version 301
2022/09/07 10:14:01 routers/common/db.go:34:InitDBEngine() [I] Backing off for 3 seconds
2022/09/07 10:14:04 routers/common/db.go:27:InitDBEngine() [I] ORM engine initialization attempt #7/10...
2022/09/07 10:14:04 cmd/web.go:160:runWeb() [I] PING DATABASE mssql
2022/09/07 10:14:04 routers/common/db.go:33:InitDBEngine() [E] ORM engine initialization attempt #7/10 failed. Error: TLS Handshake failed: tls: server selected unsupported protocol version 301
2022/09/07 10:14:04 routers/common/db.go:34:InitDBEngine() [I] Backing off for 3 seconds
2022/09/07 10:14:07 routers/common/db.go:27:InitDBEngine() [I] ORM engine initialization attempt #8/10...
2022/09/07 10:14:07 cmd/web.go:160:runWeb() [I] PING DATABASE mssql
2022/09/07 10:14:07 routers/common/db.go:33:InitDBEngine() [E] ORM engine initialization attempt #8/10 failed. Error: TLS Handshake failed: tls: server selected unsupported protocol version 301
2022/09/07 10:14:07 routers/common/db.go:34:InitDBEngine() [I] Backing off for 3 seconds
2022/09/07 10:14:10 routers/common/db.go:27:InitDBEngine() [I] ORM engine initialization attempt #9/10...
2022/09/07 10:14:10 cmd/web.go:160:runWeb() [I] PING DATABASE mssql
2022/09/07 10:14:10 routers/common/db.go:33:InitDBEngine() [E] ORM engine initialization attempt #9/10 failed. Error: TLS Handshake failed: tls: server selected unsupported protocol version 301
2022/09/07 10:14:10 routers/common/db.go:34:InitDBEngine() [I] Backing off for 3 seconds
2022/09/07 10:14:13 routers/common/db.go:27:InitDBEngine() [I] ORM engine initialization attempt #10/10...
2022/09/07 10:14:13 cmd/web.go:160:runWeb() [I] PING DATABASE mssql
2022/09/07 10:14:13 routers/init.go:66:mustInitCtx() [F] code.gitea.io/gitea/routers/common.InitDBEngine(ctx) failed: TLS Handshake failed: tls: server selected unsupported protocol version 301

i founded something related this issue here but can’t make it work

You have been hit by: The status of gitea 1.17 service is always "starting" in windows when SSH is Disabled · Issue #20609 · go-gitea/gitea · GitHub

this is fixed in 1.17.2

I tried with new release 1.17.2 but i still encounter the same issue

2022/09/08 09:23:17 ...dules/setting/log.go:335:newLogService() [I] Gitea Log Mode: File(File:info)
2022/09/08 09:23:17 ...dules/setting/log.go:249:generateNamedLogger() [I] Router Log: Console(console:info)
2022/09/08 09:23:17 ...les/setting/cache.go:76:newCacheService() [I] Cache Service Enabled
2022/09/08 09:23:17 ...les/setting/cache.go:91:newCacheService() [I] Last Commit Cache Service Enabled
2022/09/08 09:23:17 ...s/setting/session.go:73:newSessionService() [I] Session Service Enabled
2022/09/08 09:23:17 ...es/setting/mailer.go:127:newMailService() [I] Mail Service Enabled
2022/09/08 09:23:17 ...s/storage/storage.go:176:initAttachments() [I] Initialising Attachment storage with type: 
2022/09/08 09:23:17 ...les/storage/local.go:46:NewLocalStorage() [I] Creating new Local Storage at D:\gitea\bin\data\attachments
2022/09/08 09:23:17 ...s/storage/storage.go:170:initAvatars() [I] Initialising Avatar storage with type: 
2022/09/08 09:23:17 ...les/storage/local.go:46:NewLocalStorage() [I] Creating new Local Storage at D:\gitea\bin\data\avatars
2022/09/08 09:23:17 ...s/storage/storage.go:188:initRepoAvatars() [I] Initialising Repository Avatar storage with type: 
2022/09/08 09:23:17 ...les/storage/local.go:46:NewLocalStorage() [I] Creating new Local Storage at D:\gitea\bin\data\repo-avatars
2022/09/08 09:23:17 ...s/storage/storage.go:182:initLFS() [I] Initialising LFS storage with type: 
2022/09/08 09:23:17 ...les/storage/local.go:46:NewLocalStorage() [I] Creating new Local Storage at D:/gitea/data/lfs
2022/09/08 09:23:17 ...s/storage/storage.go:194:initRepoArchives() [I] Initialising Repository Archive storage with type: 
2022/09/08 09:23:17 ...les/storage/local.go:46:NewLocalStorage() [I] Creating new Local Storage at D:\gitea\bin\data\repo-archive
2022/09/08 09:23:17 ...s/storage/storage.go:200:initPackages() [I] Initialising Packages storage with type: 
2022/09/08 09:23:17 ...les/storage/local.go:46:NewLocalStorage() [I] Creating new Local Storage at D:\gitea\bin\data\packages
2022/09/08 09:23:17 routers/init.go:130:GlobalInitInstalled() [I] SQLite3 support is enabled
2022/09/08 09:23:17 routers/common/db.go:20:InitDBEngine() [I] Beginning ORM engine initialization.
2022/09/08 09:23:17 routers/common/db.go:27:InitDBEngine() [I] ORM engine initialization attempt #1/10...
2022/09/08 09:23:17 cmd/web.go:160:runWeb() [I] PING DATABASE mssql
2022/09/08 09:23:17 routers/common/db.go:33:InitDBEngine() [E] ORM engine initialization attempt #1/10 failed. Error: TLS Handshake failed: tls: server selected unsupported protocol version 301
2022/09/08 09:23:17 routers/common/db.go:34:InitDBEngine() [I] Backing off for 3 seconds
2022/09/08 09:23:20 routers/common/db.go:27:InitDBEngine() [I] ORM engine initialization attempt #2/10...
2022/09/08 09:23:20 cmd/web.go:160:runWeb() [I] PING DATABASE mssql
2022/09/08 09:23:20 routers/common/db.go:33:InitDBEngine() [E] ORM engine initialization attempt #2/10 failed. Error: TLS Handshake failed: tls: server selected unsupported protocol version 301
2022/09/08 09:23:20 routers/common/db.go:34:InitDBEngine() [I] Backing off for 3 seconds
2022/09/08 09:23:23 routers/common/db.go:27:InitDBEngine() [I] ORM engine initialization attempt #3/10...
2022/09/08 09:23:23 cmd/web.go:160:runWeb() [I] PING DATABASE mssql
2022/09/08 09:23:23 routers/common/db.go:33:InitDBEngine() [E] ORM engine initialization attempt #3/10 failed. Error: TLS Handshake failed: tls: server selected unsupported protocol version 301
2022/09/08 09:23:23 routers/common/db.go:34:InitDBEngine() [I] Backing off for 3 seconds
2022/09/08 09:23:26 routers/common/db.go:27:InitDBEngine() [I] ORM engine initialization attempt #4/10...
2022/09/08 09:23:26 cmd/web.go:160:runWeb() [I] PING DATABASE mssql
2022/09/08 09:23:26 routers/common/db.go:33:InitDBEngine() [E] ORM engine initialization attempt #4/10 failed. Error: TLS Handshake failed: tls: server selected unsupported protocol version 301
2022/09/08 09:23:26 routers/common/db.go:34:InitDBEngine() [I] Backing off for 3 seconds
2022/09/08 09:23:29 routers/common/db.go:27:InitDBEngine() [I] ORM engine initialization attempt #5/10...
2022/09/08 09:23:29 cmd/web.go:160:runWeb() [I] PING DATABASE mssql
2022/09/08 09:23:29 routers/common/db.go:33:InitDBEngine() [E] ORM engine initialization attempt #5/10 failed. Error: TLS Handshake failed: tls: server selected unsupported protocol version 301
2022/09/08 09:23:29 routers/common/db.go:34:InitDBEngine() [I] Backing off for 3 seconds
2022/09/08 09:23:32 routers/common/db.go:27:InitDBEngine() [I] ORM engine initialization attempt #6/10...
2022/09/08 09:23:32 cmd/web.go:160:runWeb() [I] PING DATABASE mssql
2022/09/08 09:23:32 routers/common/db.go:33:InitDBEngine() [E] ORM engine initialization attempt #6/10 failed. Error: TLS Handshake failed: tls: server selected unsupported protocol version 301
2022/09/08 09:23:32 routers/common/db.go:34:InitDBEngine() [I] Backing off for 3 seconds
2022/09/08 09:23:35 routers/common/db.go:27:InitDBEngine() [I] ORM engine initialization attempt #7/10...
2022/09/08 09:23:35 cmd/web.go:160:runWeb() [I] PING DATABASE mssql
2022/09/08 09:23:35 routers/common/db.go:33:InitDBEngine() [E] ORM engine initialization attempt #7/10 failed. Error: TLS Handshake failed: tls: server selected unsupported protocol version 301
2022/09/08 09:23:35 routers/common/db.go:34:InitDBEngine() [I] Backing off for 3 seconds
2022/09/08 09:23:38 routers/common/db.go:27:InitDBEngine() [I] ORM engine initialization attempt #8/10...
2022/09/08 09:23:38 cmd/web.go:160:runWeb() [I] PING DATABASE mssql
2022/09/08 09:23:38 routers/common/db.go:33:InitDBEngine() [E] ORM engine initialization attempt #8/10 failed. Error: TLS Handshake failed: tls: server selected unsupported protocol version 301
2022/09/08 09:23:38 routers/common/db.go:34:InitDBEngine() [I] Backing off for 3 seconds
2022/09/08 09:23:41 routers/common/db.go:27:InitDBEngine() [I] ORM engine initialization attempt #9/10...
2022/09/08 09:23:41 cmd/web.go:160:runWeb() [I] PING DATABASE mssql
2022/09/08 09:23:41 routers/common/db.go:33:InitDBEngine() [E] ORM engine initialization attempt #9/10 failed. Error: TLS Handshake failed: tls: server selected unsupported protocol version 301
2022/09/08 09:23:41 routers/common/db.go:34:InitDBEngine() [I] Backing off for 3 seconds
2022/09/08 09:23:44 routers/common/db.go:27:InitDBEngine() [I] ORM engine initialization attempt #10/10...
2022/09/08 09:23:44 cmd/web.go:160:runWeb() [I] PING DATABASE mssql
2022/09/08 09:23:44 routers/init.go:66:mustInitCtx() [F] code.gitea.io/gitea/routers/common.InitDBEngine(ctx) failed: TLS Handshake failed: tls: server selected unsupported protocol version 301

is your mssql instance running and accessible?

Hello,

yes of course and it works with 1.16.4 but not with 1.16.5 and following releases.
I’m having a look to changelog between 1.16.4 and next releases.
i’m investigating on a possible server side issue too.

regards

I upgraded mssql server 2014 to SP3 and it solved that issue.

Regards