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

No way to detect when a Pyre's ZBeacon has exited #100

Open
SillyFreak opened this issue Aug 5, 2016 · 1 comment
Open

No way to detect when a Pyre's ZBeacon has exited #100

SillyFreak opened this issue Aug 5, 2016 · 1 comment

Comments

@SillyFreak
Copy link

To illustrate, run this:

import logging
from pyre import Pyre

logger = logging.getLogger('pyre')
logger.setLevel(logging.DEBUG)
logger.addHandler(logging.StreamHandler())

pyre = Pyre()
pyre.start()

As long as there's a network connection during startup, you will get output like this:

...
Set up a broadcast beacon to w.x.y.z:5670

When you disable your network connection, you will get the following output:

Network seems gone, exiting zbeacon

(in addition, if the network was not available during startup, there's an exception in prepare_udp)

The corresponding actor exits and sends shim_pipe.signal() (i.e. a single part message), but PyreNode ignores this. In particular, this happens here:

def recv_beacon(self):
    # Get IP address and beacon of peer
    try:
        ipaddress, frame = self.beacon_socket.recv_multipart()
    except ValueError:
        return 

I don't see a way to work around this while still using the Pyre class, and I'm not sure about the proper fix. Is a node without a beacon useful, or is that a reason for shutting the Node down?

@sphaero
Copy link
Contributor

sphaero commented Aug 8, 2016

We should mimic Zyre's behaviour. I'm not sure what that is currently.

In general we should raise an exception so the user can decide.

Zyre uses zsys's udp methods:
https://github.com/zeromq/czmq/blob/master/src/zsys.c#L889
They will return -1 if a send fails.
Zbeacon does nothing with -1 so it will continue if the network is gone...

https://github.com/zeromq/czmq/blob/master/src/zbeacon.c#L300

However I'm not sure if the beacon will continue if the network is back... Has anybody tested such behaviour?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants