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

Requests never completed if decoding fails #26

Closed
dontgitit opened this issue Mar 21, 2020 · 1 comment · Fixed by #27
Closed

Requests never completed if decoding fails #26

dontgitit opened this issue Mar 21, 2020 · 1 comment · Fixed by #27
Labels

Comments

@dontgitit
Copy link

dontgitit commented Mar 21, 2020

Operation completes its promise with the result of redisCommand.decodeReply (in completeSuccess and tryCompleteSuccess).
However, if the deserializer throws an exception, it never completes the promise (and I think the thrown exception might cause other issues too).
This is possible with custom ByteStringDeserializer or RedisReplyDeserializer that throws in certain scenarios. It's even possible if you try to get something holding an unexpected value, for instance, set("key", "value") followed by get[Double]("key"). The ActorSystem ends up dumping something like java.lang.NumberFormatException: For input string: "value", but the Future returned by get never completes.

Maybe it should be changed to something like:

  def completeSuccess(redisReply: RedisReplyT): Promise[T] = {
    promise.complete(Try(redisCommand.decodeReply(redisReply)))
  }
  def tryCompleteSuccess(redisReply: RedisReply) = {
    promise.tryComplete(Try(redisCommand.decodeReply(redisReply.asInstanceOf[RedisReplyT])))
  }
@Ma27 Ma27 added the bug label Mar 21, 2020
@Ma27
Copy link
Owner

Ma27 commented Mar 21, 2020

Thanks a lot for your report! Would you mind filing a patch with your suggested change (and if possible, a testcase or an instruction to reproduce the issue)?

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

Successfully merging a pull request may close this issue.

2 participants