Closed quixoten closed 11 years ago
From the ZMQ Guide:
If you are opening and closing a lot of sockets, that's probably a sign that you need to redesign your application. In some cases socket handles won't be freed until you destroy the context.
I'm satisfied that ZMQ is not meant to operate in this way.
This might be an issue with the ZMQ library itself, but I wanted to post it here first.
Running the following code produces a "Bad file descriptor" error on my linux machine running ZMQ version 3.2.3. It also happens on OSX running ZMQ version 3.2.2. It appears to be caused by creating/destroying many contexts and sockets in rapid succession in different threads.
Using a single context for all the requests removes the error. Creating/destroying the contexts and sockets synchronously removes the error as well.