zeromq/zmqpp

Assertion failed: sizeof(int32_t) == size(part)

sunkin351 opened this issue · 8 comments

Assertion failed: sizeof(int32_t) == size(part), file C:\...\zmqpp\src\zmqpp\message.cpp, line 139

Does anyone know how to fix this by any chance? I get this when I try receiving a message on my server.
EDIT: Might I add, I do need an answer real soon, I would like to get this project done as soon as possible so I can start on my next one.

xaqq commented

It sounds like you are trying to receive an int32_t (4 bytes) while the client is sending something else: maybe an int64_t (8bytes) or a int16_t? Is your client written using zmqpp too?

It is written with the zmqpp bindings from scratch. However, it should be receiving a string, not a number.

EDIT: Unless there is something about the stream operators that I am missing... I did notice you guys used a template for operator>>...

May I please get some acknowledgement that this issue is being worked on?

EDIT: Something is definitely not right with your template function operator>>, it asserts every time I try to use it.

xaqq commented

May I please get some acknowledgement that this issue is being worked on?

I have no problem sending string, so no it's not. Can you provide a reproducible example code so we can investigate why it doesn't work for you?

Now that I make a "test" application, it doesn't assert... though it doesn't quite work... There is still the issue of data being corrupted during transport on my system (Microsoft Windows 10, MSVC 14 compiler). I send a string of characters, and I get something to the effect of Ç ), where pretty much next to nothing is received... Here is my source code I made on the fly to test this:

TestProgram.zip

Would this have something to do with character encoding?

Send one message from the dealer socket but the router socket receives 2... The first one being not of any use to my application, as well as causing exceptions and unexpected/undefined behavior. I am unable to track down the problem, though I suspect the problem is within the socket class. Check what it does when you send something from a dealer socket with these bindings.

(EDIT: If this is an intended feature of the router/xreply socket, say, the first string is the identity of the sender, i am sorry, I have not been able to find online documentation for these bindings.)
(EDIT2: Might even be something with libzmq, idk.)

Nvm... I am so sorry for taking up your time, i didn't realize it would give me the client identity through the message... But thank you for your consideration...

xaqq commented

Yes the first frame of a message read on a router socket is the identity of the client. No problem, happy it works for you now.