socks5 connection errors
halaei opened this issue · 1 comments
halaei commented
Prerequisites
- I am running the latest version of awslambdaproxy
- I am have read the README instructions and the FAQ
Description
When I test the socks proxy using curl, I see it randomly fails:
curl -x socks5://user:password@localhost:8080 https://google.com -v
* Trying 127.0.0.1:8080...
* TCP_NODELAY set
* SOCKS5 communication to google.com:443
* SOCKS5 connect to IPv4 *.*.*.*:443 (locally resolved)
* Can't complete SOCKS5 connection to *.*.*.*:443. (4)
* Closing connection 0
curl: (7) Can't complete SOCKS5 connection to *.*.*.*:443. (4)
Steps to Reproduce
- Run curl command with -x option as said above a until it fails.
Expected behavior: [What you expected to happen]
No failure
Actual behavior: [What actually happened]
Connection errors
Environment
- If you are using CLI, get the version and specify the full command you are using.
./awslambdaproxy --version
awslambdaproxy version 0.0.14
./awslambdaproxy run -r us-west-2,us-west-1,us-east-1,us-east-2,ca-central-1,eu-central-1,eu-west-1,eu-west-2,eu-west-3 -f 360s
Error Output
2020/11/21 15:12:42 tunnelconnection.go:125: 2 Unique Lambda IPs used so far
2020/11/21 15:12:42 tunnelconnection.go:126: ---------------
2020/11/21 15:13:01 tunnelconnection.go:196: Delayed cleanup now running for 127.0.0.1:57746
2020/11/21 15:13:01 tunnelconnection.go:200: Removing tunnel 127.0.0.1:57746
2020/11/21 15:13:01 tunnelconnection.go:171: error closing connection for connectionID=127.0.0.1:57746: close tcp 127.0.0.1:8081->127.0.0.1:57746: use of closed network connection
2020/11/21 15:18:40 lambdaexecution.go:54: Executing Lambda function in region us-east-1
2020/11/21 15:18:40 lambdaexecution.go:65: Setting invoke configuration maximumRetryAttempts=0 maximumEventAgeInSeconds=1800
2020/11/21 15:18:40 lambdaexecution.go:95: Invoking Lambda function with UUID=***
2020/11/21 15:18:41 tunnelconnection.go:81: Accepted tunnel connection from 127.0.0.1:38564
2020/11/21 15:18:41 tunnelconnection.go:89: Established session to 127.0.0.1:38564
2020/11/21 15:18:41 tunnelconnection.go:192: Tunnel '127.0.0.1:33912' that is being closed still has 916 open streams. Delaying cleanup for 20s.
2020/11/21 15:18:42 tunnelconnection.go:110: ---------------
2020/11/21 15:18:42 tunnelconnection.go:111: Current Lambda IP Address: *.*.*.*
2020/11/21 15:18:42 tunnelconnection.go:112: Active Lambda tunnel count: 2
2020/11/21 15:18:42 tunnelconnection.go:115: Lambda Tunnel #1
2020/11/21 15:18:42 tunnelconnection.go:116: Connection ID: 127.0.0.1:38564
2020/11/21 15:18:42 tunnelconnection.go:117: Start Time: 2020-11-21T15:18:41
2020/11/21 15:18:42 tunnelconnection.go:118: Active Streams: 1
2020/11/21 15:18:42 tunnelconnection.go:115: Lambda Tunnel #2
2020/11/21 15:18:42 tunnelconnection.go:116: Connection ID: 127.0.0.1:33912
2020/11/21 15:18:42 tunnelconnection.go:117: Start Time: 2020-11-21T15:12:41
2020/11/21 15:18:42 tunnelconnection.go:118: Active Streams: 916
2020/11/21 15:18:42 tunnelconnection.go:125: 3 Unique Lambda IPs used so far
2020/11/21 15:18:42 tunnelconnection.go:126: ---------------
2020/11/21 15:19:01 tunnelconnection.go:196: Delayed cleanup now running for 127.0.0.1:33912
2020/11/21 15:19:01 tunnelconnection.go:200: Removing tunnel 127.0.0.1:33912
2020/11/21 15:19:01 tunnelconnection.go:171: error closing connection for connectionID=127.0.0.1:33912: close tcp 127.0.0.1:8081->127.0.0.1:33912: use of closed network connection
2020/11/21 15:24:40 lambdaexecution.go:54: Executing Lambda function in region us-east-2
2020/11/21 15:24:40 lambdaexecution.go:65: Setting invoke configuration maximumRetryAttempts=0 maximumEventAgeInSeconds=1800
2020/11/21 15:24:40 lambdaexecution.go:95: Invoking Lambda function with UUID=***
2020/11/21 15:24:41 tunnelconnection.go:192: Tunnel '127.0.0.1:38564' that is being closed still has 872 open streams. Delaying cleanup for 20s.
2020/11/21 15:24:42 tunnelconnection.go:81: Accepted tunnel connection from 127.0.0.1:42924
2020/11/21 15:24:42 tunnelconnection.go:89: Established session to 127.0.0.1:42924
2020/11/21 15:24:42 tunnelconnection.go:110: ---------------
2020/11/21 15:24:42 tunnelconnection.go:111: Current Lambda IP Address: 18.191.212.184
2020/11/21 15:24:42 tunnelconnection.go:112: Active Lambda tunnel count: 2
2020/11/21 15:24:42 tunnelconnection.go:115: Lambda Tunnel #1
2020/11/21 15:24:42 tunnelconnection.go:116: Connection ID: 127.0.0.1:42924
2020/11/21 15:24:42 tunnelconnection.go:117: Start Time: 2020-11-21T15:24:42
2020/11/21 15:24:42 tunnelconnection.go:118: Active Streams: 2
2020/11/21 15:24:42 tunnelconnection.go:115: Lambda Tunnel #2
2020/11/21 15:24:42 tunnelconnection.go:116: Connection ID: 127.0.0.1:38564
2020/11/21 15:24:42 tunnelconnection.go:117: Start Time: 2020-11-21T15:18:41
2020/11/21 15:24:42 tunnelconnection.go:118: Active Streams: 872
2020/11/21 15:24:42 tunnelconnection.go:125: 4 Unique Lambda IPs used so far
2020/11/21 15:24:42 tunnelconnection.go:126: ---------------
2020/11/21 15:25:01 tunnelconnection.go:49: Failed to accept user connection
2020/11/21 15:25:01 tunnelconnection.go:196: Delayed cleanup now running for 127.0.0.1:38564
2020/11/21 15:25:01 tunnelconnection.go:200: Removing tunnel 127.0.0.1:38564
2020/11/21 15:25:01 tunnelconnection.go:171: error closing connection for connectionID=127.0.0.1:38564: close tcp 127.0.0.1:8081->127.0.0.1:38564: use of closed network connection
dan-v commented
Hi @halaei - I'll just point you at the FAQ (7. Why does my connection drop periodically?). Also, it appears you have a large number of open connections based on the active stream numbers you posted; be aware 1) there is an upper limit on the number of outbound connections from a single Lambda function and 2) this proxy isn't designed to be a high connection / high performance proxy in its current form.