I’ve been hacking with ZeroMQ for some time now… reading through the excellent guide and working on the preliminary steps to incorporate it into the new version (migrated to GitHub from Google Code) of my Doppler radar analysis application. Multi-threading support was on the list of original criterion and considering many of the other analysis features I’d like to eventually add, full distributed processing would be the best design. I’m not an expert hand at SMP application design and although the implementation needs here would be fairly trivial, choosing a good library to handle the nasty bits would make things vastly easier.
So I tinkered with several of their samples designs, implemented a few of the patterns in my code and tested things out. Initial results with just a simple multithreaded service seemed work OK at first glance but eventually dropped data caused issues so I decided to try something with reliability such as the paranoid pirate pattern (robust reliable queuing). Thinking back, I should have realised something was up when it exhibited that issue on both inproc IPC and tcp/localhost. No matter what I was trying to do porting examples into my code nothing remained stable; either it crashed immediately or processed a few messages then died. C and C++ code showed similar results. Running the examples on their own worked fine. The front-end/client-side Python application worked fine. I gave it a fresh shot with another example – the Majordomo pattern (service-oriented reliable queuing) again showed similar symptoms of instability. Commenting out huge sections of my code thinking it may of had something to do with a broken pointer or some other oversight on my part had little to no results. Eventually I started comparing the GCC invocations and noticed there were some minor differences. After 5 minutes of testing the weeks of tinkering finally yielded some fruit… Google confirmed my suspicions: linking ZeroMQ with -pg for gprof support crashes the library.
It’s amazing how quick it can be to find what you’re looking for when you know exactly what you want. At least now I can get back to implementing 0MQ in my code.