darkk / redsocks

transparent TCP-to-proxy redirector

Home Page:http://darkk.net.ru/redsocks

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

File descriptors never closed??

riaqn opened this issue · comments

I used redsocks mostly to proxy my torrent client, so the number of connection is expected to be high. But the number seems unreasonably high.

27172 is the pid of redsocks.

root@darkbox /p/27172# ls -l /proc/27172/fd | wc -l
16459

Note at this time I have my torrent client closed. So I honestly don't understand how is this possible.

Everytime I start redsocks, it functions normally in the begining, then the number of fd increases until it reaches the limit of fd at which point it refuses to accept more connection. I then have to restart redsocks.

Also I try to find more info about these fd, they seem to be the same.

lrwx------ 1 redsocks redsocks 64 Jan 18 11:54 9995 -> 'socket:[945748]'
lrwx------ 1 redsocks redsocks 64 Jan 18 11:54 9996 -> 'socket:[945749]'
lrwx------ 1 redsocks redsocks 64 Jan 18 11:54 9997 -> 'socket:[945750]'
lrwx------ 1 redsocks redsocks 64 Jan 18 11:54 9998 -> 'socket:[945751]'
lrwx------ 1 redsocks redsocks 64 Jan 18 11:54 9999 -> 'socket:[945752]'

root@darkbox /p/27172# cat /proc/27172/fdinfo/11067
pos:	0
flags:	04002
mnt_id:	9
root@darkbox /p/27172# cat /proc/27172/fdinfo/11020
pos:	0
flags:	04002
mnt_id:	9
root@darkbox /p/27172# cat /proc/27172/fdinfo/5510
pos:	0
flags:	04002
mnt_id:	9

This issue is apparently related to #99
Also I tried kill -USR1, which causes redsocks to segfault.

Jan 18 18:32:48 darkbox redsocks[32768]: Dumping client list for socks5 at 0.0.0.0:31338:
Jan 18 18:32:48 darkbox systemd[1]: redsocks.service: Main process exited, code=dumped, status=11/SEGV
Jan 18 18:32:48 darkbox systemd[1]: redsocks.service: Failed with result 'core-dump'.