[prev in list] [next in list] [prev in thread] [next in thread]
List: zeromq-dev
Subject: [zeromq-dev] Fwd: problems with load-balancing exchange
From: Pavel Gushcha <pavimus () gmail ! com>
Date: 2009-07-29 9:06:39
Message-ID: 7f9e32180907290206j6b4b1b4cnd4ae3239d20cc796 () mail ! gmail ! com
[Download RAW message or body]
[Attachment #2 (multipart/alternative)]
I tried to buid test apps from chat example (see attaches). Prompt creates
global load-balancing exchange and display creates three api_thread with one
local queue for each api_thread. I think, i miss something, because now i
get message dups in any case (if i start prompt after display of display
after prompt).
PS: I use official release 0MQ v1.0.0
2009/7/28 Martin Sustrik <sustrik@fastmq.com>
Martin Hurton wrote:
>
>> Hi Pavel,
>>
>> Could you please prepare a minimal test program so that I can
>> reproduce this on my own?
>>
>
> Agreed. This looks like a straightforward bug. Your test program would help
> to reproduce the issue.
>
> Martin
>
[Attachment #5 (text/html)]
I tried to buid test apps from chat example (see attaches). Prompt creates global \
load-balancing exchange and display creates three api_thread with one local queue for \
each api_thread. I think, i miss something, because now i get message dups in any \
case (if i start prompt after display of display after prompt).<br> <div \
class="gmail_quote"> <br>PS: I use official release 0MQ v1.0.0<br><br><div \
class="gmail_quote">2009/7/28 Martin Sustrik <span dir="ltr"><<a \
href="mailto:sustrik@fastmq.com" \
target="_blank">sustrik@fastmq.com</a>></span><div><div></div> <div \
class="h5"><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, \
204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"> <div>Martin Hurton \
wrote:<br> <blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, \
204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"> Hi Pavel,<br>
<br>
Could you please prepare a minimal test program so that I can<br>
reproduce this on my own?<br>
</blockquote>
<br></div>
Agreed. This looks like a straightforward bug. Your test program would help to \
reproduce the issue.<br><font color="#888888"> <br>
Martin<br>
</font></blockquote></div></div></div><br><br>
</div><br>
--0016368e1b8b4455f0046fd48173--
["display.cpp" (text/x-c++src)]
/*
Copyright (c) 2007-2009 FastMQ Inc.
This file is part of 0MQ.
0MQ is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
0MQ is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <zmq/platform.hpp>
#include <zmq/formatting.hpp>
#include <string.h>
#include <string>
#include <iostream>
using namespace std;
#include <zmq.hpp>
using namespace zmq;
int main (int argc, const char *argv [])
{
// Initialise 0MQ infrastructure.
dispatcher_t dispatcher (4);
locator_t locator ("127.0.0.1");
// Initialise the thread layout
i_thread *pt = io_thread_t::create (&dispatcher);
api_thread_t *api = api_thread_t::create (&dispatcher, &locator);
api_thread_t *api2 = api_thread_t::create (&dispatcher, &locator);
api_thread_t *api3 = api_thread_t::create (&dispatcher, &locator);
// Create local queue to receive messages.
int q=api->create_queue ("Q1");
api->bind ("GLOBAL_E", "Q1", pt, pt);
int q2=api2->create_queue ("Q2");
api2->bind ("GLOBAL_E", "Q2", pt, pt);
int q3=api3->create_queue ("Q3");
api3->bind ("GLOBAL_E", "Q3", pt, pt);
message_t message;
int queue_id;
while (true) {
// Get a message and print it to the console.
queue_id=api->receive (&message,false);
if (queue_id==q)
cout << "API1 RECEIVED: "<<(char*) message.data () << flush;
queue_id=api2->receive (&message,false);
if (queue_id==q2)
cout << "API2 RECEIVED: "<<(char*) message.data () << flush;
queue_id=api3->receive (&message,false);
if (queue_id==q3)
cout << "API3 RECEIVED: "<<(char*) message.data () << flush;
}
}
["prompt.cpp" (text/x-c++src)]
/*
Copyright (c) 2007-2009 FastMQ Inc.
This file is part of 0MQ.
0MQ is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
0MQ is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <zmq/platform.hpp>
#include <zmq/formatting.hpp>
#include <string.h>
#include <string>
#include <iostream>
using namespace std;
#include <zmq.hpp>
using namespace zmq;
int main (int argc, const char *argv [])
{
// Initialise 0MQ infrastructure.
dispatcher_t dispatcher (2);
locator_t locator ("127.0.0.1");
// Initialise the thread layout
i_thread *pt = io_thread_t::create (&dispatcher);
api_thread_t *api = api_thread_t::create (&dispatcher, &locator);
// Create local exchange to send messages to.
int eid = api->create_exchange ("GLOBAL_E",zmq::scope_global,"*",pt,1,&pt,zmq::style_load_balancing);
while (true) {
// Allow user to input the message text. Prepend it by user name.
char textbuf [1024];
char *rcc = fgets (textbuf, sizeof (textbuf), stdin);
assert (rcc);
string text = textbuf;
// Create the message (terminating zero is part of the message)
message_t message (text.size () + 1);
memcpy (message.data (), text.c_str (), text.size () + 1);
// Send the message
api->send (eid, message);
}
}
["zmq_server.conf" (application/octet-stream)]
_______________________________________________
zeromq-dev mailing list
zeromq-dev@lists.zeromq.org
http://lists.zeromq.org/mailman/listinfo/zeromq-dev
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic