Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

E_INVALID REQ could not parse timeout HASH(0xadb8ba8) - failed to convert to Base10 #1

Open
cnmota opened this issue Sep 1, 2014 · 1 comment

Comments

@cnmota
Copy link

cnmota commented Sep 1, 2014

This is the message on nsqd

2014/09/02 00:21:05 ERROR: [127.0.0.1:60252] - E_INVALID REQ could not parse timeout HASH(0xadb8ba8) - failed to convert to Base10

Will add further info later on

@melo
Copy link
Owner

melo commented Sep 2, 2014

He complains that he cannot parse the timeout…

The timeout is being sent on this line https://github.com/melo/perl-anyevent-nsq/blob/master/lib/AnyEvent/NSQ/Connection.pm#L182 as the $delay parameter. The previous lines would normalise it if the $delay parameter had an integer value.

Going back, this code is called from https://github.com/melo/perl-anyevent-nsq/blob/master/lib/AnyEvent/NSQ/Reader.pm#L51 and as you can see the delay parameter is the return value of your message handling code, which needs to be an integer.

So check the message handling code on your side. It should be one off:

  • undef: message is done;
  • equal or greater than -1: a REQ will be sent with that value as delay.

If you return a hashRef, it will end-up on this branch (a string like that would be converted to 0), and it will fail all the normalisation tests we have on requeue_msg() also, and it would end up on the protocol.

I think -1 case is a bug, it should be >= 0, but this issue would still be allowed through.

You can read about what the delay is used for here: http://nsq.io/clients/tcp_protocol_spec.html#req Basically, it is the number of seconds nsqd will wait before resending the message.

So, to summarise, look at your message code, you are returning a hashRef somewhere, and you need to return either undef or a >= 0 integer.

Finally, this setup with return codes doesn't allow for asynchronous processing of messages, you cannot start something else, and later call a method to mark the message as done, or requeued.

I've been emailing another developer also using this code and he will write that part and send us, so we'll get it eventually.

Bye,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants