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
45.07k stars 5.49k forks source link

Cannot Start Gitea 1.6.0 - MySQL/MariaDB Related #5413

Closed johnstonjs closed 5 years ago

johnstonjs commented 5 years ago

Command line-

$ ./gitea-1.6.0-linux-amd64 web
2018/11/26 20:13:18 [T] AppPath: /usr/local/bin/gitea/gitea-1.6.0-linux-amd64            
2018/11/26 20:13:18 [T] AppWorkPath: /usr/local/bin/gitea                                
2018/11/26 20:13:18 [T] Custom path: /usr/local/bin/gitea/custom                         
2018/11/26 20:13:18 [T] Log path: /usr/local/bin/gitea/log 

logs/gitea.log

2018/11/26 20:13:19 [...itea/routers/init.go:60 GlobalInit()] [E] Failed to initialize ORM engine: migrate: do migrate: Error 1071: Specified key was too long; max key length is 767 bytes

Description

Gitea 1.5.3 is running flawlessly, though I originally had trouble initializing the MySQL database as documented in #2979. The workarounds described there were sufficient to run the v1.5 series of Gitea.

Attempting to upgrade to Gitea 1.6.0, the command line output stops at the Log path as shown above. The log file logs/gitea.log only shows the failure above. This appears related to #4663. I have attempted the workarounds documented there, including converting the table topic to utf8 and setting _rowformat to dynamic. Neither of these workarounds resolved the issue.

I can provide further info from MySQL if needed, but would appreciate guidance on specific commands to use to find the results requested. My experience with manipulating MySQL databases is limited (effectively zero).

There are no additional entries into xorm.log when attempting to run Gitea 1.6.0.

v1.5.3 Log Output

When running Gitea 1.5.3, the following entries appear in xorm.log. They indicate issues with my MySQL database configuration, and so I thought they may be relevant.

2018/11/26 20:09:48 [W] Table user Column allow_create_organization db default is 1, struct default is true
2018/11/26 20:09:48 [W] Table user Column prohibit_login db default is 0, struct default is false
2018/11/26 20:09:48 [W] Table repository Column is_fork db default is 0, struct default is false
2018/11/26 20:09:48 [W] Table repository Column is_fsck_enabled db default is 1, struct default is true
2018/11/26 20:09:48 [W] Table action Column is_deleted db default is 0, struct default is
false
2018/11/26 20:09:48 [W] Table action Column is_private db default is 0, struct default is
false
2018/11/26 20:09:48 [W] Table mirror Column enable_prune db default is 1, struct default is true
2018/11/26 20:09:48 [W] Table release Column is_draft db default is 0, struct default is false
2018/11/26 20:09:48 [W] Table release Column is_prerelease db default is 0, struct default is false
2018/11/26 20:09:48 [W] Table release Column is_tag db default is 0, struct default is false
2018/11/26 20:09:48 [W] Table login_source Column is_actived db default is 0, struct default is false
2018/11/26 20:09:48 [W] Table login_source Column is_sync_enabled db default is 0, struct
default is false
2018/11/26 20:09:48 [W] Table protected_branch Column can_push db default is 0, struct default is false
2018/11/26 20:09:48 [W] Table protected_branch Column enable_merge_whitelist db default is 0, struct default is false
2018/11/26 20:09:48 [W] Table user_open_id Column show db default is 0, struct default is
false
2018/11/26 20:09:48 [W] Table comment has column old_assignee_id but struct has not related field
2018/11/26 20:09:48 [W] Table comment has column dependent_issue_id but struct has not related field
2018/11/26 20:09:48 [W] Table two_factor has column scratch_salt but struct has not related field
2018/11/26 20:09:48 [W] Table two_factor has column scratch_hash but struct has not related field

If there's further information I can provide too help with troubleshooting, please just let me know.

Thank you, again, for making such a fantastic tool.

mxmehl commented 5 years ago

I think I have the same or a similar issue:

gitea.log (I tried to start it multiple times)

2018/11/27 09:30:02 [I] Log Mode: File(Info)
2018/11/27 09:30:02 [I] XORM Log Mode: File(Info)
2018/11/27 09:30:02 [I] Cache Service Enabled
2018/11/27 09:30:02 [I] Session Service Enabled
2018/11/27 09:30:02 [I] Mail Service Enabled
2018/11/27 09:30:02 [I] Register Mail Service Enabled
2018/11/27 09:30:02 [I] Notify Mail Service Enabled
2018/11/27 09:30:02 [I] Migration: add issue_dependencies
2018/11/27 09:30:07 [I] Log Mode: File(Info)
2018/11/27 09:30:07 [I] XORM Log Mode: File(Info)
2018/11/27 09:30:07 [I] Cache Service Enabled
2018/11/27 09:30:07 [I] Session Service Enabled
2018/11/27 09:30:07 [I] Mail Service Enabled
2018/11/27 09:30:07 [I] Register Mail Service Enabled
2018/11/27 09:30:07 [I] Notify Mail Service Enabled
2018/11/27 09:30:07 [I] Migration: add issue_dependencies
2018/11/27 09:30:23 [I] Migration: protect each scratch token
2018/11/27 09:30:27 [I] Migration: add review
2018/11/27 09:30:29 [I] Migration: add must_change_password column for users table
2018/11/27 09:30:30 [I] Migration: protect each scratch token
2018/11/27 09:30:32 [I] Migration: add review
2018/11/27 09:30:33 [I] Migration: add must_change_password column for users table
2018/11/27 09:30:37 [I] Git Version: 2.1.4
2018/11/27 09:30:37 [...itea/routers/init.go:60 GlobalInit()] [E] Failed to initialize ORM engine: sync 
database struct error: Error 1060: Duplicate column name 'invalidated'
2018/11/27 09:31:05 [I] Log Mode: File(Info)
2018/11/27 09:31:05 [I] XORM Log Mode: File(Info)
2018/11/27 09:31:05 [I] Cache Service Enabled
2018/11/27 09:31:05 [I] Session Service Enabled
2018/11/27 09:31:05 [I] Mail Service Enabled
2018/11/27 09:31:05 [I] Register Mail Service Enabled
2018/11/27 09:31:05 [I] Notify Mail Service Enabled
2018/11/27 09:31:07 [I] Git Version: 2.1.4
2018/11/27 09:31:30 [I] SQLite3 Supported
2018/11/27 09:31:30 [I] Run Mode: Production
2018/11/27 09:31:31 [I] Listen: http://0.0.0.0:3000
2018/11/27 09:32:06 [I] SQLite3 Supported
2018/11/27 09:32:06 [I] Run Mode: Production
2018/11/27 09:32:06 [I] Listen: http://0.0.0.0:3000
2018/11/27 09:32:06 [....io/gitea/cmd/web.go:211 runWeb()] [E] Failed to start server: listen tcp 0.0.0.
0:3000: bind: address already in use
2018/11/27 09:32:41 [I] Log Mode: File(Info)
2018/11/27 09:32:41 [I] XORM Log Mode: File(Info)
2018/11/27 09:32:41 [I] Cache Service Enabled
2018/11/27 09:32:41 [I] Session Service Enabled
2018/11/27 09:32:41 [I] Mail Service Enabled
2018/11/27 09:32:41 [I] Register Mail Service Enabled
2018/11/27 09:32:41 [I] Notify Mail Service Enabled
2018/11/27 09:32:42 [I] Git Version: 2.1.4

The xorm.log is too messy to find out the relevant entries since I've had to downgrade to 1.5.3 again and the instance is heavily used.

mxmehl commented 5 years ago

I tried again and it worked now. I cannot tell why...

lunny commented 5 years ago

Please feel free to reopen this.

johnstonjs commented 5 years ago

I was able to correct the issue by adding the following lines to /etc/mysql/mariadb.conf.d/50-server.cnf

innodb_file_format = Barracuda
innodb_large_prefix = 1
innodb_default_row_format = dynamic

I'm not sure why those weren't already in there, but it's interesting that it didn't cause an issue for 1.5.3 but did for 1.6.0. Either way, successfully running 1.6.0 now without having to reinstall the database.

Thanks again.

lunny commented 5 years ago

@johnstonjs maybe some columns have too long length but it's an index.