fp7-netide / Engine

App Engine to enable Network App programs to be executed, systematically tested, and refined on a variety of concrete SDN platforms
Eclipse Public License 1.0
10 stars 11 forks source link

LogPub does not receive properly messages on SUB queue (port 5558) #94

Closed sergiotamu closed 8 years ago

sergiotamu commented 8 years ago

Hello @KevinPhemius,

In those days I have been migrating the Network Profiler tool to the new version, but I had some troubles. So, I began with the most basic: Sending a message to the PUB queue on port 5558. For this purpose, I use this piece of code:

import zmq
import time

context = zmq.Context()
publisher = context.socket(zmq.PUB)
publisher.connect("tcp://127.0.0.1:5558")
src = "np1"
dst = "1_"
data_string = "hello"

time.sleep(1)
publisher.send(src, len(src), zmq.SNDMORE);
publisher.send(dst, len(dst), zmq.SNDMORE);
publisher.send(data_string, len(data_string), 0);

I realized that the LogPub was doing nothing with the messages, because I could not see any log in the Core console, neither notifying me an error nor notifying me an event. Therefore, I decided to check if my python script was wrong. But, using the same script I sent some messages to another port and with another script I could receive without problems such messages. So there was a problem in the LogPub.

Besides, another test I did was to check with wireshark that the messages went to Port 5558, but from port 5558 no message was originated.

The last step I did was debugging the LogPub and here I think that I found a possible error: By means of log messages I observed that in the method 'public void run()' the execution goes into the loop:

try{
     ZMQ.Poller poller = new ZMQ.Poller(2);
     poller.register(subSocket, ZMQ.Poller.POLLIN);
     poller.register(controlSocket, ZMQ.Poller.POLLIN);
     **log.info("Register the queues in the poller");**
     while (!Thread.currentThread().isInterrupted()) {
     **log.info("Inizialiting variables 1");**
     poller.poll(10);

However the execution NEVER goes into:

if (poller.pollin(0)) {
       log.info("receiving messages");
       ZMsg zmqMessage = ZMsg.recvMsg(subSocket);
       String dst = null;
       String src = null;
       byte[] data = null;

Neither goes into:

if (poller.pollin(1)) {
       log.debug("Messages are not being received");
       ZMsg message = ZMsg.recvMsg(controlSocket);

And the execution should access in one of these two "if".

So, could you test the LogPub (the PUB queue) and take a look into this???

Thanks in advance, Sergio.

KevinPhemius commented 8 years ago

Hi Sergio,

are you talking about the PUB or the SUB queue? The PUB is on 5557 and the SUB on 5558.

The execution goes into

if (poller.pollin(1)) {
       log.debug("Messages are not being received");
       ZMsg message = ZMsg.recvMsg(controlSocket);

whenever a message is received on the controlSocket. This is how messages are published in the PUB queue (or that the LogPub exits if it receive the right command). It goes to the other branch if a message is received on the subSocket. The subSocket never send anything so there shouldn't be any message form the 5558 port.


Kévin

sergiotamu commented 8 years ago

Hi Kevin,

Yes, I was talking about SUB queue (the one which is on 5558 port). The port 5558 should send something to another module. I mean, when a message is received in the port 5558 then the message should be forwarded to the shim or to the backends, no??.

In the first comment I wrote what I wanted to say is that I send a message to the SUB queue, but i cannot see any log in the core. So there is a problem, because the LogPub is not doing anything with that message and according to the code It should notice me that an error has been produced or that the message has been received in the SUB queue.

Have you tested the SUB queue with success?? If you have achieved it, please explain me how I have to do it. Thanks =)

KevinPhemius commented 8 years ago

Hi Sergio,

You script must use the PUSH socket of 0MQ instead of the PUB

publisher = context.socket(zmq.PUSH)

Also, the message your trying to send is not in the correct format (NetIDE header + payload) so the LogPub can't parse it correctly so it crashed.

There is a fix in this commit (87524f6) for this uncatched error.


Kévin

sergiotamu commented 8 years ago

Hi Kevin,

Yes, I was trying to send a "simple" message and see if the LogPub notified an error or that the message had arrived properly to SUB queue. I will try the new version of the LogPub, and also I will include the NetIDE header to the message.

Thanks =)

Sergio.

KevinPhemius commented 8 years ago

Hi Sergio,

is that issue still open?


Kévin

sergiotamu commented 8 years ago

Hello Kevin,

Yes, the issue is opened because I have to send some messages with the NetIDE format to test the LogPub =).

Sergio

El 10/05/16 a las 10:52, Kévin Phemius escribió:

Hi Sergio,

is that issue still open?


Kévin

— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub https://github.com/fp7-netide/Engine/issues/94#issuecomment-218096887