Increase gitea db connection limit
By default our mariadb database for gitea nodes limits itself to a maximum of 100 connections. We've seen errors like this: ...eb/routing/logger.go:102:func1() [I] router: completed POST /openstack/requirements/git-upload-pack for 127.0.0.1:50562, 500 Internal Server Error in 2.6ms @ context/user.go:17(web.gitHTTPRouters.UserAssignmentWeb) ...ules/context/repo.go:467:RepoAssignment() [E] GetUserByName: Error 1040: Too many connections And after reading gitea's source code this appears to be related to user lookups to determine if the user making a request against a repo owns the repo. To do this gitea does a db request to lookup the user from the request and when this hits the connection limit it bubbles up the mysql error 1040: Too may connections error. This problem seems infrequent so we double the limit to 200 which is both much larger but still a reasonable number. We also modify the test that checks for gitea server errors without an http 500 return code to avoid it matching this change improperly. This was happening because the commit message ends up in the rendered pages for system-config in the test gitea. Change-Id: If8c72ab277e88ae09a44a64a1571f94e43df23f8
This commit is contained in:
parent
3e6c282d54
commit
dbe477b205
2
playbooks/roles/gitea/files/99-max_conn_my.cnf
Normal file
2
playbooks/roles/gitea/files/99-max_conn_my.cnf
Normal file
@ -0,0 +1,2 @@
|
||||
[mysqld]
|
||||
max_connections=200
|
@ -24,6 +24,13 @@
|
||||
template:
|
||||
src: app.ini.j2
|
||||
dest: /var/gitea/conf/app.ini
|
||||
- name: Write mariadb conn limit config file
|
||||
copy:
|
||||
src: 99-max_conn_my.cnf
|
||||
dest: /var/gitea/conf/99-max_conn_my.cnf
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0644
|
||||
- name: Install distro packages
|
||||
package:
|
||||
name:
|
||||
|
@ -14,6 +14,7 @@ services:
|
||||
MYSQL_PASSWORD: "{{ gitea_db_password }}"
|
||||
volumes:
|
||||
- /var/gitea/db:/var/lib/mysql
|
||||
- /var/gitea/conf/99-max_conn_my.cnf:/etc/mysql/conf.d/99-max_conn_my.cnf:ro
|
||||
logging:
|
||||
driver: syslog
|
||||
options:
|
||||
|
@ -130,7 +130,7 @@ def test_no_500_template_content(host):
|
||||
'--resolve gitea99.opendev.org:3081:127.0.0.1 '
|
||||
'https://gitea99.opendev.org:3081' + path)
|
||||
assert 'status-page-500' not in cmd.stdout
|
||||
assert 'Internal Server Error' not in cmd.stdout
|
||||
assert '<title>Internal Server Error' not in cmd.stdout
|
||||
|
||||
def test_gitea_screenshots(host):
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user