cloudfoundry / socks5-proxy

This is a go library for starting a socks5 proxy server via SSH
https://cloudfoundry.org
Apache License 2.0
52 stars 21 forks source link

Errors are reported when multiple socks5 proxy instances are started at the same time #9

Closed tylerschultz closed 6 years ago

tylerschultz commented 6 years ago

I encountered an error when using the bosh-cli that appears to be a race condition.

I ran an ssh command against multiple instances and saw error output that looked like this:

socks5 proxy: listen tcp 127.0.0.1:65527: bind: address already in usesocks5 proxy: listen tcp 127.0.0.1:65527: bind: address already in usesocks5 proxy: listen tcp 127.0.0.1:65527: bind: address already in usesocks5 proxy: listen tcp 127.0.0.1:65527: bind: address already in

Connor suspects this line could be a 'check then act' problem: https://github.com/cloudfoundry/socks5-proxy/blob/master/socks5_proxy.go#L102

More context here: https://cloudfoundry.slack.com/archives/C02HPPYQ2/p1523553995000694

cf-gitbot commented 6 years ago

We have created an issue in Pivotal Tracker to manage this:

https://www.pivotaltracker.com/story/show/156768819

The labels on this github issue will be updated when the story is started.

cppforlife commented 6 years ago

Connor suspects this line could be a 'check then act' problem

sounds like a race between closing acquired eph port and using it for the server. right?

cwlbraa commented 6 years ago

fixed at https://github.com/cloudfoundry/socks5-proxy/commit/75791c35e37dfa939d956361aaf9569e66c0e318