lettuce icon indicating copy to clipboard operation
lettuce copied to clipboard

What is the meaning of ClusterClientOptions TimeoutOptions?

Open yangkangquan123 opened this issue 2 years ago • 2 comments

Feature Request

Is your feature request related to a problem? Please describe

The configuration for using lettuce in our service is as follows: ClusterClientOptions clientOptions = ClusterClientOptions.builder() .timeoutOptions(TimeoutOptions.enabled(Duration.ofMillis(1000))) .autoReconnect(true) .maxRedirects(3) .pingBeforeActivateConnection(false) .disconnectedBehavior(ClientOptions.DisconnectedBehavior.REJECT_COMMANDS) .socketOptions(socketOptions) .topologyRefreshOptions(clusterTopologyRefreshOptions) .cancelCommandsOnReconnectFailure(false) .protocolVersion(ProtocolVersion.RESP2) .build();

The following error information is displayed during service running: java.util.concurrent.CompletionException: io.lettuce.core.RedisCommandTimeoutException: Command timed out after 1 second(s) at java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:292) at java.util.concurrent.CompletableFuture.completeThrowable(CompletableFuture.java:308) at java.util.concurrent.CompletableFuture.biRelay(CompletableFuture.java:1300) at java.util.concurrent.CompletableFuture$BiRelay.tryFire(CompletableFuture.java:1284) at java.util.concurrent.CompletableFuture$CoCompletion.tryFire(CompletableFuture.java:1034) at java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:488) at java.util.concurrent.CompletableFuture.completeExceptionally(CompletableFuture.java:1990) at io.lettuce.core.protocol.AsyncCommand.doCompleteExceptionally(AsyncCommand.java:139) at io.lettuce.core.protocol.AsyncCommand.completeExceptionally$original$yKf0WaAm(AsyncCommand.java:132) at io.lettuce.core.protocol.AsyncCommand.completeExceptionally$original$yKf0WaAm$accessor$HHhaprxn(AsyncCommand.java) at io.lettuce.core.protocol.AsyncCommand$auxiliary$TO9bajWk.call(Unknown Source) at org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.InstMethodsInter.intercept(InstMethodsInter.java:86) at io.lettuce.core.protocol.AsyncCommand.completeExceptionally(AsyncCommand.java) at io.lettuce.core.cluster.ClusterCommand.completeExceptionally$original$ECOE1qPZ(ClusterCommand.java:99) at io.lettuce.core.cluster.ClusterCommand.completeExceptionally$original$ECOE1qPZ$accessor$knWUXfon(ClusterCommand.java) at io.lettuce.core.cluster.ClusterCommand$auxiliary$CfagtcCY.call(Unknown Source) at org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.InstMethodsInter.intercept(InstMethodsInter.java:86) at io.lettuce.core.cluster.ClusterCommand.completeExceptionally(ClusterCommand.java) at io.lettuce.core.protocol.CommandExpiryWriter.lambda$potentiallyExpire$0(CommandExpiryWriter.java:175) at io.netty.util.concurrent.PromiseTask.runTask(PromiseTask.java:98) at io.netty.util.concurrent.ScheduledFutureTask.run(ScheduledFutureTask.java:153) at io.netty.util.concurrent.AbstractEventExecutor.runTask(AbstractEventExecutor.java:174) at io.netty.util.concurrent.DefaultEventExecutor.run(DefaultEventExecutor.java:66) at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997) at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) at java.lang.Thread.run(Thread.java:748) Caused by: io.lettuce.core.RedisCommandTimeoutException: Command timed out after 1 second(s) at io.lettuce.core.internal.ExceptionFactory.createTimeoutException(ExceptionFactory.java:59) at io.lettuce.core.protocol.CommandExpiryWriter.lambda$potentiallyExpire$0(CommandExpiryWriter.java:176) ... 8 common frames omitted

The error logs show that the Redis command times out, but no Redis slow log is displayed in the monitoring. This problem is caused by the TimeoutOptions parameter. What is the meaning of the TimeoutOptions parameter? Is it the timeout period of the command?

Describe the solution you'd like

A clear and concise description of what you want to happen. Add any considered drawbacks.

Describe alternatives you've considered

A clear and concise description of any alternative solutions or features you've considered.

Teachability, Documentation, Adoption, Migration Strategy

If you can, explain how users will be able to use this and possibly write out a version the docs. Maybe a screenshot or design?

yangkangquan123 avatar Sep 05 '23 07:09 yangkangquan123

Timeouts are set on a per-command basis. Once a command is dispatched (that is being invoked on the API) the timeout starts. Any preceding slow command or a blocking command can contribute that a subsequent command isn't completed.

TimeoutOptions is documented with a bit of these details. What additional information are you looking for?

mp911de avatar Oct 09 '23 07:10 mp911de

If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 30 days this issue will be closed.

github-actions[bot] avatar Oct 09 '24 00:10 github-actions[bot]