Skip to content
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

Dial timeout? #85

Open
ckoehler opened this issue Jul 2, 2020 · 7 comments
Open

Dial timeout? #85

ckoehler opened this issue Jul 2, 2020 · 7 comments
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@ckoehler
Copy link

ckoehler commented Jul 2, 2020

I don't think ZMQ connects should be timing out like you are doing. See http://api.zeromq.org/4-1:zmq-connect, the whole point is that pub/sub/bind/connect order doesn't matter. pebbe/zmq4 does not time out on connect/Dial.

@sbinet sbinet added bug Something isn't working help wanted Extra attention is needed labels Jul 2, 2020
@sbinet
Copy link
Contributor

sbinet commented Jul 2, 2020

you're right.

@ckoehler
Copy link
Author

ckoehler commented Jul 2, 2020

May be as simple as removing the check and return at

zmq4/socket.go

Line 236 in 59e906c

if retries < 10 {
. The sleep is a good idea. No expert, though.

Also, thanks so much for doing this, it's saving me a lot of pain trying to build my app for other architectures. No CGO is a win!

@ckoehler
Copy link
Author

ckoehler commented Jul 2, 2020

This is a better reference: https://rfc.zeromq.org/spec/23/#socket-semantics

@guidog
Copy link
Contributor

guidog commented Nov 1, 2020

Hi!

At the moment the user facing .Dial is synchronous. This should be kept that way.

The spec talks about "reconnect", which in my view is something different from the initial connect.

I would opt for the following:

  1. leave the initial connect synchronous to get some errors back (network unreachable, unknown host etc.)
  2. implement a reconnect method used after there has been a successful first connection

While implementing 1. I'd like to add a context.Context to the .Dial methods or add a .DialContext method.

Cheers
Guido

@thielepaul
Copy link
Contributor

I think that the numbers of retries should be configurable, if the user sets it to infinite (could be -1 or so) then the behavior will be very similar to the libzmq implementation, while still being synchronous

@sbinet
Copy link
Contributor

sbinet commented Jun 9, 2022

sure, why not.
do you want to try your hand at a PR?

@thielepaul
Copy link
Contributor

do you want to try your hand at a PR?

yes, I think I could. Not sure when I will have time for it, though

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants