[zeromq-dev] Error handling in client code.
Martin Sustrik
sustrik at fastmq.com
Mon May 11 10:32:42 CEST 2009
Hi John,
> Is it not possible to establish a (generic) condition handler which
> catches this kind of thing rather than having the program go south?
Yes, it's actually pretty easy.
> The high-level language wrapper that exists for OpenVMS does just
> this. All it does today is call a standard condition handler which
> simply signals the error, reports the "true" error, e.g., "connection
> refused" in the case of ZMQ_SERVER not being present and allows the
> abort to continue. It could do something a bit more robust.
I'm open to adding the error code, as it is useful for application with
low reliability requirements. However, it should be made clear that when
developing a high-reliability application, developers should make sure
that the error never occurs rather than trying to handle it in a decent
manner. Two examples:
1. A submarine. Limited number of devices on board, but need for
ultra-high reliability. Even if part of submarine is destroyed/flooded
the rest should still work. zmq_server would be a single point of
failure. It makes sense to hard-wire the location of all the components
directly to each executable. It doesn't hurt as the topology is static
and on the other had it allows even the two last components alive to
communicate (given there's still a physical connection between them).
2. A bank. The topology is dynamic. Still, the system has to be highly
reliable. Locations of components should be stored in a directory
service. The directory service should be replication to individual
branch offices so that even a broken connection to the main office won't
prevent local components to communicate with each other or with
components in other branch offices that are still accessible.
> Along the above lines I would be more than interested to learn a bit
> more about your option "1. Tweak the code to return error instead of
> assertion.".
It boils down to returning an error code instead of asserting :)
Martin
More information about the zeromq-dev
mailing list