redsocks icon indicating copy to clipboard operation
redsocks copied to clipboard

red_connect_relay failed!!!: Too many open files

Open ysun opened this issue 4 years ago • 6 comments

Hi, I got a failure:

1582741581.368003 notice main.c:255 main(...) redsocks started with: epoll
1582741582.989604 err utils.c:141 red_prepare_relay(...) socket: Too many open files 
1582741582.989625 err redsocks.c:693 redsocks_connect_relay(...) [10.239.48.13:47898->10.239.48.147:80]: red_connect_relay failed!!!: Too many open files 

My redsocks.conf:

base {
        log_debug = off; 
        log_info = on;
        log = stderr;
        daemon = off;
        redirector = iptables;
        reuseport = off; 
}
redsocks {
        bind = "127.0.0.1:12345"; 
        relay = "10.239.48.147:80"; 
        type = socks5;
                                                                                     
        autoproxy = 0; 
        timeout = 10; 
} 
 
autoproxy { 
    no_quick_check_seconds = 60; // Directly relay traffic to proxy if an IP 
    quick_connect_timeout = 3;   // Timeout value when performing quick 
} 

command of iptables: iptables -t nat -A OUTPUT -p tcp -j REDIRECT --to-ports 12345 iptables -t nat -A OUTPUT -d 127.0.0.0/8 -j RETURN

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination
RETURN     all  --  anywhere             localhost/8
REDIRECT   tcp  --  anywhere             anywhere             redir ports 12345

I'm not expert of network, could you guide me a little bit, what's wrong here? Thanks

ysun avatar Feb 26 '20 02:02 ysun

This issue is usually caused by redirection loop. follow examples here https://github.com/darkk/redsocks/blob/master/README.md

or, you can google it. Many people met the same problem.

Eason [email protected] 于 2020年2月26日周三 10:36写道:

Hi, I got a failure:

1582741581.368003 notice main.c:255 main(...) redsocks started with: epoll 1582741582.989604 err utils.c:141 red_prepare_relay(...) socket: Too many open files 1582741582.989625 err redsocks.c:693 redsocks_connect_relay(...) [10.239.48.13:47898->10.239.48.147:80]: red_connect_relay failed!!!: Too many open files

My redsocks.conf:

base { log_debug = off; log_info = on; log = stderr; daemon = off; redirector = iptables; reuseport = off; } redsocks { bind = "127.0.0.1:12345"; relay = "10.239.48.147:80"; type = socks5;

    autoproxy = 0;
    timeout = 10;

}

autoproxy { no_quick_check_seconds = 60; // Directly relay traffic to proxy if an IP quick_connect_timeout = 3; // Timeout value when performing quick }

command of iptables: iptables -t nat -A OUTPUT -p tcp -j REDIRECT --to-ports 12345

I'm not expert of network, could you guide me a little bit, what's wrong here? Thanks

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/semigodking/redsocks/issues/141?email_source=notifications&email_token=AAP2XD6EKREDDADC7CH3GY3REXIRXA5CNFSM4K33QPT2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4IQJGLFQ, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAP2XD6KUM5NTWMKJKVO5BLREXIRXANCNFSM4K33QPTQ .

semigodking avatar Feb 27 '20 12:02 semigodking

hello if the upstream proxy does not respond , redsocks keeps the idle connection until it times out , and if the incoming load is large , it runs out of ports and logs those messages ; this is just by experience ; in my case i had configured the upstream proxy with its DNS name ; and someone changed the IP of that name ; this seems to have caused this issue ! HTH Regards

shareef1973 avatar Mar 18 '20 21:03 shareef1973

的确是BUG, 用 https://github.com/darkk/redsocks 编译的,HTTP代理就正常,可以排除loop

muziling avatar Apr 18 '20 04:04 muziling

那就奇怪了,得研究一下

muziling [email protected] 于 2020年4月18日周六 12:21写道:

的确是BUG, 用 https://github.com/darkk/redsocks 编译的,HTTP代理就正常,可以排除loop

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/semigodking/redsocks/issues/141#issuecomment-615554030, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAP2XD4CW6ZBM4FORX4EYMDRNETGLANCNFSM4K33QPTQ .

semigodking avatar Apr 18 '20 14:04 semigodking

redsocks 在早期也有这个BUG,修复过 https://github.com/darkk/redsocks/issues/90

muziling avatar Apr 21 '20 01:04 muziling

我没有用过HTTP代理。我都是使用其他代理。每天都在使用,从没有出现过这种问题啊。

muziling [email protected] 于 2020年4月21日周二 09:26写道:

redsocks 在早期也有这个BUG,修复过 darkk#90 https://github.com/darkk/redsocks/issues/90

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/semigodking/redsocks/issues/141#issuecomment-616895288, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAP2XD35LN7SVERJ44OAPUDRNTY3NANCNFSM4K33QPTQ .

semigodking avatar Apr 24 '20 15:04 semigodking