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

Got a response when no response was expected! #44

Open
vstoyak opened this issue Apr 21, 2014 · 7 comments
Open

Got a response when no response was expected! #44

vstoyak opened this issue Apr 21, 2014 · 7 comments

Comments

@vstoyak
Copy link

vstoyak commented Apr 21, 2014

Getting "Got a response when no response was expected!" which fails the client. Any help with what could be wrong?

@cainus
Copy link
Owner

cainus commented Apr 21, 2014

We've seen that in a few scenarios, but it's tough for me to guess which one you're experiencing. Usually it happens when you give an incorrect offset in a fetch, meaning that you're probably not storing/passing the offsets correctly. I haven't seen this in a very long time though.

@elee
Copy link
Collaborator

elee commented Apr 21, 2014

+1 to @cainus' comment. one way to possibly diagnose the issue would be to investigate in and around the offset with the bundled Kafka command line tools. Issuing the following from the bin dir:

 $ ./kafka-simple-consumer-shell.sh --server kafka://kafka-broker.com:9092 --topic mytopic --offset 8675309 --print-messages --print-offsets 

Where the argument to --offset is the offset you're fetching in Prozess, may help you to diagnose the issue.

@vstoyak
Copy link
Author

vstoyak commented Apr 21, 2014

Thanks! will do. One other question, why is it handled through "throw" with no callback call with error message?

@cainus
Copy link
Owner

cainus commented Apr 21, 2014

Ohh... good question... Now that I look at the code, that bad-offset case is actually caught earlier. The exception in this case is one that should never be raised, so I left it as a throw. It shouldn't be possible to trigger this, but I often throw in the default block of a switch statement as a safeguard when there is no logical default. Sooo... now that you've accomplished what I anticipated would be impossible, I'd love to know if you have any steps to reproduce this. ;)

Also, just for sanity's sake: You're using Kafka 0.7 right?

@vstoyak
Copy link
Author

vstoyak commented Apr 21, 2014

Unfortunately it is hard to reproduce and I am yet to identify any patterns, it can happen few days apart. Yes, we use 0.7

@kankele
Copy link

kankele commented Jun 19, 2014

I just ran into this same issue. My application usually runs fine for a while (1 - 6 hours), then exits with this error. I have an theory on what is going on. I don't see any code in Consumer.js that prevents a user from calling consume, then calling it again before the first call has completed. If this occurs, you would be waiting for 2 socket responses from kafka. When you receive the first one, it would set the requestMode to null so when the second response was received you would hit the default switch code that generates this error. I eliminated this problem in my code by not calling consume within an interval timer (my guess is that sometimes the response was delayed long enough that the interval fired again and I made another call to consume). In the prozess code maybe check requestMode when consume is called and return an error if it is not null. This would prevent a second request from being sent to Kafka until the first one has completed??

@cainus
Copy link
Owner

cainus commented Jun 21, 2014

Hmmm I'm a bit torn on how to solve this, since I don't have time to actually test it properly. It would be easy enough to just return the error in a callback, but it would be something lame along the lines of:

  callback(new Error('you just found a rare race condition bug.  just refetch'));

This is obviously a stupid fix, even though it's an improvement over the current state.

Of course if you've got the time to test your proposed better solution, I'd certainly be happy to take a PR.

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

4 participants