requilence / integram

Integrate Telegram into your workflow – Trello, Gitlab, Bitbucket and other bots
https://integram.org
GNU General Public License v3.0
1.54k stars 151 forks source link

net/http: too many open files #78

Closed kswgit closed 5 years ago

kswgit commented 5 years ago

Envrionment

aws t2.micro(1 cores, 1GB RAM)

git clone https://github.com/requilence/integram && cd integram
export INTEGRAM_PORT=80
export INTEGRAM_BASE_URL="http://ec2-***.compute.amazonaws.com"
export GITLAB_BOT_TOKEN="***"
export GITLAB_OAUTH_ID="***"
export GITLAB_OAUTH_SECRET="***"
export INTEGRAM_DEBUG=1
docker-compose -p integram up -d gitlab

Problem

Integram works very well for few hours but doesn't work after.

logs:

docker logs -f $(docker ps -aqf "name=integram_integram")   
http: Accept error: accept tcp [::]:80: accept4: too many open files; retrying in 1s
http: Accept error: accept tcp [::]:80: accept4: too many open files; retrying in 1s
http: Accept error: accept tcp [::]:80: accept4: too many open files; retrying in 1s
...

...and tcp fds are

ls -laht /proc/{integram_pid}/fd
l-wx------ 1 root root 64 Mar 30 01:31 1 -> /dev/null
lrwx------ 1 root root 64 Mar 30 01:31 10 -> socket:[258859]
lrwx------ 1 root root 64 Mar 30 01:31 100 -> socket:[259636]
lrwx------ 1 root root 64 Mar 30 01:31 1000 -> socket:[267908]
lrwx------ 1 root root 64 Mar 30 01:31 1001 -> socket:[267922]
lrwx------ 1 root root 64 Mar 30 01:31 1002 -> socket:[267924]
lrwx------ 1 root root 64 Mar 30 01:31 1003 -> socket:[267932]
lrwx------ 1 root root 64 Mar 30 01:31 1004 -> socket:[267934]
lrwx------ 1 root root 64 Mar 30 01:31 1005 -> socket:[267948]
lrwx------ 1 root root 64 Mar 30 01:31 1006 -> socket:[267950]
lrwx------ 1 root root 64 Mar 30 01:31 1007 -> socket:[267965]
lrwx------ 1 root root 64 Mar 30 01:31 1008 -> socket:[267967]
lrwx------ 1 root root 64 Mar 30 01:31 1009 -> socket:[267992]
lrwx------ 1 root root 64 Mar 30 01:31 101 -> socket:[259658]
lrwx------ 1 root root 64 Mar 30 01:31 1010 -> socket:[267994]
lrwx------ 1 root root 64 Mar 30 01:31 1011 -> socket:[268009]
lrwx------ 1 root root 64 Mar 30 01:31 1012 -> socket:[268011]
lrwx------ 1 root root 64 Mar 30 01:31 1013 -> socket:[268025]
lrwx------ 1 root root 64 Mar 30 01:31 1014 -> socket:[268027]
lrwx------ 1 root root 64 Mar 30 01:31 1015 -> socket:[268042]
lrwx------ 1 root root 64 Mar 30 01:31 1016 -> socket:[268044]
lrwx------ 1 root root 64 Mar 30 01:31 1017 -> socket:[268058]
lrwx------ 1 root root 64 Mar 30 01:31 1018 -> socket:[268060]
lrwx------ 1 root root 64 Mar 30 01:31 1019 -> socket:[268115]
lrwx------ 1 root root 64 Mar 30 01:31 102 -> socket:[259660]
lrwx------ 1 root root 64 Mar 30 01:31 1020 -> socket:[268117]
lrwx------ 1 root root 64 Mar 30 01:31 103 -> socket:[259674]
lrwx------ 1 root root 64 Mar 30 01:31 104 -> socket:[259676]
lrwx------ 1 root root 64 Mar 30 01:31 105 -> socket:[259690]
lrwx------ 1 root root 64 Mar 30 01:31 106 -> socket:[259692]
lrwx------ 1 root root 64 Mar 30 01:31 107 -> socket:[259706]
lrwx------ 1 root root 64 Mar 30 01:31 108 -> socket:[259708]
lrwx------ 1 root root 64 Mar 30 01:31 109 -> socket:[259734]
lr-x------ 1 root root 64 Mar 30 01:31 11 -> net:[4026532041]
lrwx------ 1 root root 64 Mar 30 01:31 110 -> socket:[259736]
lrwx------ 1 root root 64 Mar 30 01:31 111 -> socket:[259750]
lrwx------ 1 root root 64 Mar 30 01:31 112 -> socket:[259752]
lrwx------ 1 root root 64 Mar 30 01:31 113 -> socket:[259766]
lrwx------ 1 root root 64 Mar 30 01:31 114 -> socket:[259768]
lrwx------ 1 root root 64 Mar 30 01:31 115 -> socket:[259782]
lrwx------ 1 root root 64 Mar 30 01:31 116 -> socket:[259784]
lrwx------ 1 root root 64 Mar 30 01:31 117 -> socket:[259799]
lrwx------ 1 root root 64 Mar 30 01:31 118 -> socket:[259801]
lrwx------ 1 root root 64 Mar 30 01:31 119 -> socket:[259815]
lrwx------ 1 root root 64 Mar 30 01:31 12 -> socket:[258874]
...(total 1022)

I think this problem is very simillar to this - https://stackoverflow.com/a/48342086.