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

Exeption on zpopmin #3199

Open
nicolube opened this issue Feb 28, 2025 · 2 comments
Open

Exeption on zpopmin #3199

nicolube opened this issue Feb 28, 2025 · 2 comments
Labels
status: mre-available Minimal Reproducible Example is available status: waiting-for-feedback We need additional information before we can continue

Comments

@nicolube
Copy link

nicolube commented Feb 28, 2025

Bug Report

Current Behavior

I encoutered an exeption while poping something from an sorted set.

Stack trace
[01:25:58] [ForkJoinPool.commonPool-worker-5/WARN]: Caused by: java.lang.UnsupportedOperationException: io.lettuce.core.pubsub.PubSubCommandHandler$ResponseHeaderReplayOutput does not support set(double)
[01:25:58] [ForkJoinPool.commonPool-worker-5/WARN]: 	at PrimeCorePlugin-0.3.7-SNAPSHOT.jar//io.lettuce.core.output.CommandOutput.set(CommandOutput.java:123)
[01:25:58] [ForkJoinPool.commonPool-worker-5/WARN]: 	at PrimeCorePlugin-0.3.7-SNAPSHOT.jar//io.lettuce.core.protocol.RedisStateMachine.safeSet(RedisStateMachine.java:798)
[01:25:58] [ForkJoinPool.commonPool-worker-5/WARN]: 	at PrimeCorePlugin-0.3.7-SNAPSHOT.jar//io.lettuce.core.protocol.RedisStateMachine.handleFloat(RedisStateMachine.java:455)
[01:25:58] [ForkJoinPool.commonPool-worker-5/WARN]: 	at PrimeCorePlugin-0.3.7-SNAPSHOT.jar//io.lettuce.core.protocol.RedisStateMachine$State$Type.handle(RedisStateMachine.java:210)
[01:25:58] [ForkJoinPool.commonPool-worker-5/WARN]: 	at PrimeCorePlugin-0.3.7-SNAPSHOT.jar//io.lettuce.core.protocol.RedisStateMachine.doDecode(RedisStateMachine.java:363)
[01:25:58] [ForkJoinPool.commonPool-worker-5/WARN]: 	at PrimeCorePlugin-0.3.7-SNAPSHOT.jar//io.lettuce.core.protocol.RedisStateMachine.decode(RedisStateMachine.java:324)
[01:25:58] [ForkJoinPool.commonPool-worker-5/WARN]: 	at PrimeCorePlugin-0.3.7-SNAPSHOT.jar//io.lettuce.core.protocol.CommandHandler.decode(CommandHandler.java:857)
[01:25:58] [ForkJoinPool.commonPool-worker-5/WARN]: 	at PrimeCorePlugin-0.3.7-SNAPSHOT.jar//io.lettuce.core.protocol.CommandHandler.decode0(CommandHandler.java:808)
[01:25:58] [ForkJoinPool.commonPool-worker-5/WARN]: 	at PrimeCorePlugin-0.3.7-SNAPSHOT.jar//io.lettuce.core.protocol.CommandHandler.decode(CommandHandler.java:791)
[01:25:58] [ForkJoinPool.commonPool-worker-5/WARN]: 	at PrimeCorePlugin-0.3.7-SNAPSHOT.jar//io.lettuce.core.protocol.CommandHandler.decode(CommandHandler.java:674)
[01:25:58] [ForkJoinPool.commonPool-worker-5/WARN]: 	at PrimeCorePlugin-0.3.7-SNAPSHOT.jar//io.lettuce.core.pubsub.PubSubCommandHandler.decode(PubSubCommandHandler.java:97)
[01:25:58] [ForkJoinPool.commonPool-worker-5/WARN]: 	at PrimeCorePlugin-0.3.7-SNAPSHOT.jar//io.lettuce.core.protocol.CommandHandler.channelRead(CommandHandler.java:614)
[01:25:58] [ForkJoinPool.commonPool-worker-5/WARN]: 	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:442)
[01:25:58] [ForkJoinPool.commonPool-worker-5/WARN]: 	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
[01:25:58] [ForkJoinPool.commonPool-worker-5/WARN]: 	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)
[01:25:58] [ForkJoinPool.commonPool-worker-5/WARN]: 	at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410)
[01:25:58] [ForkJoinPool.commonPool-worker-5/WARN]: 	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:440)
[01:25:58] [ForkJoinPool.commonPool-worker-5/WARN]: 	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
[01:25:58] [ForkJoinPool.commonPool-worker-5/WARN]: 	at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919)
[01:25:58] [ForkJoinPool.commonPool-worker-5/WARN]: 	at io.netty.channel.epoll.AbstractEpollStreamChannel$EpollStreamUnsafe.epollInReady(AbstractEpollStreamChannel.java:800)
[01:25:58] [ForkJoinPool.commonPool-worker-5/WARN]: 	at io.netty.channel.epoll.EpollEventLoop.processReady(EpollEventLoop.java:509)
[01:25:58] [ForkJoinPool.commonPool-worker-5/WARN]: 	at io.netty.channel.epoll.EpollEventLoop.run(EpollEventLoop.java:407)
[01:25:58] [ForkJoinPool.commonPool-worker-5/WARN]: 	at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997)
[01:25:58] [ForkJoinPool.commonPool-worker-5/WARN]: 	at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
[01:25:58] [ForkJoinPool.commonPool-worker-5/WARN]: 	at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
[01:25:58] [ForkJoinPool.commonPool-worker-5/WARN]: 	at java.base/java.lang.Thread.run(Thread.java:1583)

Input Code

Input Code
import io.lettuce.core.RedisClient
import io.lettuce.core.codec.RedisCodec
import io.lettuce.core.codec.StringCodec

fun main() {
    val client = RedisClient.create("redis://localhost")
    val connection = client.connectPubSub(RedisCodec.of(StringCodec.ASCII, StringCodec.UTF8)).sync()

    connection.zadd("myzset", 1.0, "one")
    connection.zadd("myzset", 2.0, "two")

    connection.zpopmin("myzset", 1).firstOrNull()?.takeIf { it.hasValue() }?.let {
        println("Popped value: $it")
    } ?: println("No value to pop")
}

Expected behavior/code

Well I expect it to not throw an exeption.

Environment

  • Lettuce version(s): lettuce-core:6.5.4.RELEASE
  • Redis version: redis:7.2@sha256:6da5f3c2579824a9de659e612242f3b11bc421f8aa847ba33e427c1bc122ed3d

Possible Solution

Well currently i do this:

val polled = redisCommands.eval<String>("return redis.call('zpopmin', '$setKey', 1)[1]", ScriptOutputType.VALUE, arrayOf())

But that is just my workaround.

Additional context

@tishun tishun added status: waiting-for-triage status: mre-available Minimal Reproducible Example is available labels Feb 28, 2025
@tishun
Copy link
Collaborator

tishun commented Feb 28, 2025

Hey @nicolube ,

I am not able to reproduce the issue with the sample code you've provided.

... Caused by: java.lang.UnsupportedOperationException: io.lettuce.core.pubsub.PubSubCommandHandler$ResponseHeaderReplayOutput

It also seems that you are using the connection for pub/sub?
Can you provide a more complete example of your setup?

@tishun tishun added status: waiting-for-feedback We need additional information before we can continue and removed status: waiting-for-triage labels Feb 28, 2025
@nicolube
Copy link
Author

nicolube commented Mar 1, 2025

Hey @tishun ,

Sorry about that, I updated the sample above with a complete one.
I use Pub Sub for for something else, just sharing the connection.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: mre-available Minimal Reproducible Example is available status: waiting-for-feedback We need additional information before we can continue
Projects
None yet
Development

No branches or pull requests

2 participants