[zeromq-dev] disconnection / shutdown

Aamir M aamirjvm at gmail.com
Wed Mar 11 19:17:43 CET 2009


Marin,

Following is code to reproduce the problem ... It's not clear to me
how to shut down and restart all this infrastructure. The second call
create_exchange causes an assert and error message "Address already in
use" (errcode == WSAEADDRINUSE from err.cpp). This is using the latest
trunk code from the zmq repo.


#include <zmq.hpp>

int main()
{
  zmq::dispatcher_t*  dispatcher;
  zmq::locator_t*     locator;
  zmq::i_thread*      io_thread;	
  zmq::api_thread_t*  api;

  int exchangeID;

  dispatcher = new zmq::dispatcher_t( 2 );
  locator = new zmq::locator_t("10.195.6.77");
  io_thread = zmq::io_thread_t::create( dispatcher );
  api = zmq::api_thread_t::create( dispatcher, locator );
  exchangeID = api->create_exchange( "E_TEST",  zmq::scope_global,
"eth2:5555", io_thread,  1,  &io_thread, zmq::style_load_balancing);

  delete dispatcher;
  delete locator;
  delete io_thread;

  dispatcher = new zmq::dispatcher_t( 2 );
  locator = new zmq::locator_t("10.195.6.77");
  io_thread = zmq::io_thread_t::create( dispatcher );
  api = zmq::api_thread_t::create( dispatcher, locator );
  exchangeID = api->create_exchange( "E_TEST",  zmq::scope_global,
"eth2:5555", io_thread,  1,  &io_thread, zmq::style_load_balancing);

}


On Wed, Mar 11, 2009 at 5:10 AM, Martin Sustrik <sustrik at fastmq.com> wrote:
> Hi,
>
>> Is there a way to shutdown a queue and or exchange and release the
>> corresponding port? I remember reading sometime back that this was a
>> planned feature for a future release?
>>
>> I'm using ZeroMQ to implement a shared library. My shared library is
>> then dynamically loaded and unloaded as a plug-in by some user
>> process. As it is, if the user process tries to reload my plug-in then
>> the user process crashes with the message  "Address already in use."
>
> This shouldn't happen. We are deliberately setting SO_REUSEADDR on the
> sockets so that this kind of thing doesn't happen.
>
> Do you have a test code to reproduce the problem?
>
> Martin
>



More information about the zeromq-dev mailing list