[zeromq-dev] PUB/SUB overload: duplicate messages

[zeromq-dev] PUB/SUB overload: duplicate messages

At my job, I’m starting to use zeromq, a nice library for message passing and queueing. Yesterday, I was trying to figure out the reason of a strange issue (I tweeted about that): inside a simple function, I send some messages to a client via zeromq, but the client does get the right number of messages, but the content is repeated, duplicated.

I looked on Google, and it found this thread on the [zeromq-dev] mailing list (join it, it’s really interesting). In its response, Pieter explains that using a static buffer is bad for you, because of concurrent access problems to the buffer (data in the buffer are not copied, you just pass a reference to be accessed later by the I/O threads) and posts a workaround. Another response points to the “Working with Messages” paragraph in the guide: docs are always good! :D

To confirm this, I can tell you my application was able to successfully send several empty messages: the buffer was copied in the same moment I memset’d it.

This problem is present with the cppzmq C++ wrapper too, specifically with this method: dropping that (really thin) wrapper and using libzmq is better.

So, how can you fix it? Just copy the content of the static buffer inside message's data.

The more you know…

A successful Git branching model

A successful Git Branching model

In this post I present a Git branching strategy for developing and releasing software as I’ve used it in many of my projects, and which has turned out to be very successful.

Old post, but still useful. I started using this method while working for my first client: at the time my team and I were using SVN, but it was easy to use this too. Tags will be useful too. Ah, and use some sort of ticket system, it always helps.

Cassowary: respect your constraints!

Some time ago, I read a good paper about using a linear constraint solver to efficiently determine positioning and sizing of widgets in graphical user interfaces. For me, it was a novel concept and a good use of advanced mathematics I didn’t think of.

Yesterday a friend of mine showed me a cool Python GUI library that, incidentally, uses this concept (and the algorithm described in a companion paper). The pure Python library they used is called Cassowary (the same of the algorithm’s name), and it’s really simple to use. You can find more details on installation and usage on the github repository.

(Hey, Apple uses it too!)

Diplomats can devblog too!

Hi. I’m alfateam123, sometimes known as winter. I don’t really want to bore you with useless details you can easily find in the About page.

I have different blogs, but this one is the “dev” one: I’ll write about new libraries, troubleshooting of problems I’ve dealt with on work/pastime projects, interesting papers I read and opensource project I’m working on, both as maintainer and as collaborator.