[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Zero_mq stacked while receiving msg
From: |
Ardid, Salva |
Subject: |
Re: Zero_mq stacked while receiving msg |
Date: |
Thu, 25 Apr 2019 20:20:18 +0000 |
El dijous, 25 d’abril de 2019, a les 15:45:05 EDT, JohnD va escriure:
From: Ardid, Salva [mailto:address@hidden
Sent: Thursday, April 25, 2019 12:37 PM
To: John Donoghue
Cc: address@hidden
Subject: Zero_mq stacked while receiving msg
Unfortunately the receive function below gets stacked in Octave (i.e., when
obj.isMatlab == 0 ) at the zmq_recv call and I don’t have a clue what might be
wrong or how to fix it. Please note that other calls to the function seem to
work fine, and then for whatever reason one of them gets trapped. I tried
changing the number of bits to very large numbers with no difference. Any help
is more than appreciated.
function str = receive(obj)
if obj.isMatlab
msg = libstruct('zmq_msg_t', struct('hidden', zeros(1, 64,
'uint8')));
calllib('libzmq', 'zmq_msg_init', msg); % always returns 0
msglen = calllib('libzmq', 'zmq_msg_recv', msg, obj.socket,
0);
assert(msglen >= 0, obj.errortext('zmq_msg_recv'));
msgptr = calllib('libzmq', 'zmq_msg_data', msg);
if not(msgptr.isNull)
setdatatype(msgptr, 'uint8Ptr', 1, msglen);
str = uint8(msgptr.Value);
else
str = uint8([]);
end
err = calllib('libzmq', 'zmq_msg_close', msg);
assert(err == 0, obj.errortext('zmq_msg_close'));
else
% this is all transparent in Octave (internally managed by
zmq_recv)
str = zmq_recv (obj.socket, 64, 0);
end
end
--------------------------------------
Stacked ? Not sure what that means.
Note that in your malab code, the 'zmq_msg_t' structure that is 64 bytes in
size
That’s not the same as saying the received data will be 64 bytes in length
So just out of interest sake, try a larger zmq_recv size ... 1024 ?
Which version of libzmq are you using ?
Hi John,
Thanks for your email.
"Stacked" means that nothing seems to happen, if I run the code with some
verbose info I get:
> python3 pyTransplantOctaveTest.py
zeromq loaded
socket done
connection done
receiving msg
msg received
sending msg
msg sent
receiving msg
msg received
sending msg
msg sent
receiving msg
msg received
sending msg
msg sent
receiving msg
And then it stays in last `receiving message` for ever without actually
receiving it (it would be indicated by `msg received`)
I know, 64 does not need to be the maximum number, however changing that number
didn't change the behavior. I set it up to 2^31-1, because that is what the
maximum seems to be in the python side according to an exception (response =
msgpack.unpackb(self.socket.recv(), raw=False, max_bin_len=2**31-1)
I use libzmq 4.2.5
I don't see what might be wrong. Any help is more than welcome.
Thanks,
Salva
- Re: Help-octave Digest, Vol 157, Issue 40, John Donoghue, 2019/04/22
- Re: Help-octave Digest, Vol 157, Issue 40, Ardid, Salva, 2019/04/22
- Zero_mq stacked while receiving msg, Ardid, Salva, 2019/04/25
- RE: Zero_mq stacked while receiving msg, JohnD, 2019/04/25
- Re: Zero_mq stacked while receiving msg,
Ardid, Salva <=
- RE: Zero_mq stacked while receiving msg, JohnD, 2019/04/25
- Re: Zero_mq stuck while receiving msg, Ardid, Salva, 2019/04/25
- Re: Zero_mq stuck while receiving msg, Ardid, Salva, 2019/04/25
- Re: Zero_mq stuck while receiving msg, Ardid, Salva, 2019/04/25