-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
To many TimeWait Connections when git clone (LFS) #9650
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
Comments
It seems that all these connection come from our reverse-proxy
|
We use nginx-proxy # git.example.org
upstream git.example.org {
server 172.18.0.19:3000; # IP of the docker container
}
server {
server_name git.example.org;
listen 80 ;
access_log /var/log/nginx/access.log vhost;
# Only allow traffic from internal clients
include /etc/nginx/network_internal.conf;
include /etc/nginx/vhost.d/git.example.org;
location / {
proxy_pass http://git.example.org;
}
}
server {
server_name git.example.org;
listen 443 ssl http2 ;
access_log /var/log/nginx/access.log vhost;
return 500;
ssl_certificate /etc/nginx/certs/default.crt;
ssl_certificate_key /etc/nginx/certs/default.key;
} |
Maybe you can use a fast-cgi setup to reduce the number of connections. I'm not sure how's that configured, however. |
Maybe |
With netstat -ant | grep "TIME_WAIT" | grep "ffff" | awk '{print $6 " " $5 " <- " $4}' | sort -k 5 | uniq -c -f 4 I get 4546 connections from '::ffff:172.18.0.9:3000' to '::ffff:172.18.0.60:xxxxxx' in 'TIME_WAIT' where 'xxxxx' is a a long range of ports : 4546 TIME_WAIT ::ffff:172.18.0.60:xxxxxx <- ::ffff:172.18.0.9:3000
|
So it seems that gitea does not reuse the connections somehow? But this behavior is only seen when we switch the nginx-proxy... when we directly access the gitea container this bahvior is not seen? We fiddled with |
Have you looked at https://engineering.gosquared.com/optimising-nginx-node-js-and-networking-for-heavy-workloads This references: http://nginx.org/en/docs/http/ngx_http_upstream_module.html#keepalive Where it appears that nginx does not use http/1.1 by default. That might mean that simply adding keepalive, removing the connection header and setting the version as per below would work: (please note this is copied from the nginx docs and would need changing to match Gitea)
|
We have tested this, exactly as stated. |
This issue has been automatically marked as stale because it has not had recent activity. I am here to help clear issues left open even if solved or waiting for more insight. This issue will be closed if no further activity occurs during the next 2 weeks. If the issue is still valid just add a comment to keep it alive. Thank you for your contributions. |
Just today we upgraded to 1.11.2 and without the nginx proxy (which made trouble) and with [database]
DB_TYPE = mysql
HOST = git-db:3306
NAME = gitea
USER = gitea
PATH = /data/gitea/gitea.db
MAX_IDLE_CONNS = 10
CONN_MAX_LIFETIME = 45s
MAX_OPEN_CONNS = 10 we dont see TIME_WAITS anymore. |
Does the current configuration cheat sheet need to be adapted?
Perhaps one should also point out that there may be problems with (nginx) proxies in connection with LFS? |
This issue has been automatically marked as stale because it has not had recent activity. I am here to help clear issues left open even if solved or waiting for more insight. This issue will be closed if no further activity occurs during the next 2 weeks. If the issue is still valid just add a comment to keep it alive. Thank you for your contributions. |
Usually, TIME_WAIT is the expected result if you made a lot of short connections (unless there is a bug)
|
[x]
):Description
This issue is a sequel to #8273 and happend with the changes dbd0a2e probably due the used proxy and its settings...:
A clone with
git clone
of repository with lots of LFS objects (12200 objects, 12Gb) results in way too many connections (max. was approx 4500) in theTIME_WAIT
state. The connections are not DB connections. This is crucial as the there is a hard limit on connections in TIME_WAIT state, which when reached crashes/stallsgit clone
/git lfs fetch
commands etc...The number of TIME_WAIT connections increases when LFS fetches files and it can be reproduced by
rm -rf .git/lfs/objects/* git lfs fetch --all
Peak Output:
gives ca 4000 connections in
TIME_WAIT
.As seen below: The connections to the DB (port 3306) are not the problem.
There are lots of connections to ports (37312 - 41172). What are these for and why are these not reused?
All Output:
is given below
The text was updated successfully, but these errors were encountered: