[zeromq-dev] Java API is not notifed of C++ assert failures.

Martin Sustrik sustrik at fastmq.com
Sat Apr 11 21:20:46 CEST 2009


Vladimir,

> If I use the old Jzmq methods (with the thread id) then all's OK, but if I
> use the wrapper methods (which ultimately get translated into the same calls
> to the old methods) the second process dies when trying to bind.

IIRC you are working on Win32 and I assume the process dies without a 
diagnostic message.

We've been looking into the problem last week and found out that 
standard Win32 assert macro misbehaves when used within JNI.

It aborts the process, as it should, however, it doesn't print the 
message. It's completely incomprehensible why it is so, as printing to 
stdout works OK, printing to stderr works OK and CrtDbgReport works OK 
as well. assert internally calls undocumented _wassert function. There's 
no source available for that one afaics.

To fix the problem I've replaced all 930 (sic!) asserts in 
libzmq/libjzmq code by proprietary zmq_assert. Developing for Windows 
can make even a strong man cry :(

Anyway, if you get the trunk, you should get a meaningful message when 
the process fails. The message would help us to track the problem down. 
(Note that Java API have changed slightly since version 0.5, so when 
you'll switch to trunk you will have to adjust your code.)

Let us know how it goes.
Martin



More information about the zeromq-dev mailing list