Examples in zguide do not work on Mac OS X
Description
Environment
Mac OS X Snow Leopard & Lion
Attachments
2
Activity
Show:

PieterP May 9, 2012 at 7:53 PM
Fixed on zguide repo, closing.

Benjamin Depardon May 7, 2012 at 7:11 AM
Just did it!

PieterP May 5, 2012 at 8:19 AM
Benjamin, would you make a pull request on the repo with your change?

Benjamin Depardon May 2, 2012 at 1:46 PM
Patch to solve a memory management bug in s_console

Benjamin Depardon May 2, 2012 at 1:45 PM
We found the bug.
There was a problem of memory management in C++/zhelper.cpp in the s_console method (see the attached patch).
I let you review this patch.
I'm trying to use the C++ Majordomo pattern example given in github.com/imatix/zguide.
First of all, I had to modify the c script in order for the examples to commit (I included the patch).
Then, I try to run the C++ mdbroker example:
$> ./mdbroker -v
12-04-30 18:06:36 I: MDP broker/0.1.1 is active at tcp://*:5555
terminate called after throwing an instance of 'zmq::error_t'
what(): Socket operation on non-socket
Abort trap
The weird thing, is that if I only add a few calls to s_console around the brk.bind() call, the broker seems to work:
$> ./mdbroker -v
12-04-30 18:09:14 Before Bind
12-04-30 18:09:14 I: MDP broker/0.1.1 is active at tcp://*:5555
12-04-30 18:09:14 After Bind
Though, if I send an mdworker, I get a bus error:
12-04-30 18:10:38 I: received message:
--------------------------------------
[033] @D5874BA32DDE45DB8D75F7B9A14F0803
[000]
[006] MDPW01
[001] 01
[004] echo
12-04-30 18:10:38 I: registering new worker: @D5874BA32DDE45DB8D75F7B9A14F0803
12-04-30 18:10:38 I: received message:
12-04-30 18:10:38 I: sending HEARTBEAT to worker
--------------------------------------
Bus error
and the mdworker gets:
$> ./mdworker -v
12-04-30 18:10:38 I: connecting to broker at tcp://localhost:5555...
12-04-30 18:10:38 I: sending READY to broker
--------------------------------------
[000]
[006] MDPW01
[001] 01
[004] echo
12-04-30 18:10:43 I: sending HEARTBEAT to broker
--------------------------------------
[000]
[006] MDPW01
[001] 04
12-04-30 18:10:45 W: disconnected from broker - retrying...
mdworker(24927,0x100481000) malloc: *** error for object 0x1003004f0: incorrect checksum for freed object - object was probably modified after being freed.
set a breakpoint in malloc_error_break to debug
Abort trap
If I use the C example, it works just fine.
Any idea on this?