[zeromq-dev] Probably breaking virtual methods table
Martin Sustrik
sustrik at 250bpm.com
Mon Mar 29 15:47:16 CEST 2010
Hi Artur,
> I'm trying zeromq-2.0.6. The file attached contains some code that behaves unexpectedly. It has actually been written using Qt, but I've rewritten it trying to exclude all dependencies.
>
> The idea is simple - I create a thread, and talk to it using zmq-sockets with inproc binding. I create an abstract class that has basic code, and override a message-handling method in subclass. Such a subclass (Worker) doesn't work properly - after receiving some messages, a call to a virtual message-handling method fails with:
>
> "pure virtual method called
> terminate called without an active exception"
>
> I.e., instead of calling Worker's method, it tried an ancestor's abstract method.
>
> On my box it happens after ~30 iterations (messages). On the neighbour's - immediately. My box is:
> Mandriva Linux release 2009.0 (Official) for i586
> Kernel 2.6.27-desktop-0.rc8.2mnb on an i686 / \l
> gcc version 4.3.2 (GCC)
>
> valgrind doesn't show any bad memory accesses, code seems fine. I have no idea about what is wrong. Do you?
src/thread.hpp is a class internal to 0MQ. It's not intended to be used
outside of 0MQ. Manage the thread using standard pthread library
functions instead.
Martin
More information about the zeromq-dev
mailing list