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

Vladimir & Mihaela puiuvlad at optonline.net
Mon Apr 13 12:43:39 CEST 2009

Sorry, my mistake. I was delegating createExchange to createQueue and that
caused my problem. Malo's suggestion helped (thanks, Malo). I will send the
final code tonight. Vladimir

-----Original Message-----
From: Martin Sustrik [mailto:sustrik at fastmq.com]
Sent: Saturday, April 11, 2009 3:21 PM
To: Vladimir & Mihaela
Cc: zeromq-dev at lists.zeromq.org
Subject: Re: [zeromq-dev] Java API is not notifed of C++ assert


> 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
> 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.

More information about the zeromq-dev mailing list