[zeromq-dev] Java API is not notifed of C++ assert failures.
sustrik at fastmq.com
Sat Apr 11 23:44:23 CEST 2009
Holger Hoffstätte wrote:
> Martin Sustrik wrote:
>> It aborts the process, as it should, [..]
> I understand the intended motivation for this behaviour, but nevertheless
> disagree with it. It makes integration of zmq into more complex Java (or
> even C/C++) scenarios almost impossible and at best a high risk
> proposition, as the library can arbitrarily terminate the JVM and any
> other services it runs.
> A brief inspection leads me to believe that the zmq_error_handler is not
> responsible for the asserts but only reconnection, correct? IMHO it might
> be much more acceptable in a wider range of use cases to allow a pluggable
> assertion handler as well (zmq_set_failure_handler?), which should allow
> clean shutdown and restart of the entire zmq subsystem, without making
> assumptions about the lifetime of the containing process.
> Can you say if this would be possible at all?
This is pretty contentious issue. However, let's have a look at
1. Assert is caused by a bug in 0MQ. Solution: Fix the bug.
2. Assert is caused by incorrect usage of 0MQ. Solution: Fix the
3. Assert happens in a perfectly valid scenario (i.e. no bugs are
involved). Solution: Define the scenario. Prove that it is valid. Find a
systematic solution. Implement the solution.
4. The application is inherently buggy and cannot be repaired. The bugs
in application make 0MQ fail. (This can be the case with legacy
applications for example.) Solution: Fork 0MQ and write the workaround
for the problem you are experiencing.
In short, if you are having problem with a specific assert, let's fix
the problem. Don't try to introduce complex generic mechanisms to handle
Opposed? Go on, defend your case :)
More information about the zeromq-dev