-
Notifications
You must be signed in to change notification settings - Fork 71
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Embedded start/check data race #5
Comments
Btw, I played around with this code a bit and your code seems to work fine with Tor 0.3.3, but the racey behavior appears with Tor 0.3.5. Probably they changed initialization order a bit so the new Tor gets to the control port later than the current stable one. |
True, suggestions? I am not sure the best cross-platform way to wait until a port is open by an external process before proceeding. I can update I can also wait on some stdout output from the tor process I suppose, but I want the user to be able to control output verbosity. I could also do this in Suggestions? |
Ah, I bet this works with an 0 for control port because it waits for the control port file to be written. Maybe I should always use a control port file by default, expose a |
If I start an embedded tor process, you are currently starting it and immediately checking control port status https://github.com/cretz/bine/blob/master/tor/tor.go#L142:
this however is racey, because it's almost impossible for tor to start up fast enough for the control port to be open by the time you reach the check. If I explicitly add a couple second sleep before
connect
, everything works nicely, otherwise starting just fails withError on start: dial tcp 127.0.0.1:9051: connect: connection refused
.The text was updated successfully, but these errors were encountered: