Skip to content

SyncStrategy.INVALIDATE publish without subscribe possible? #2821

Open

Description

@ohlle

Hi!

We have a redis server with about 600 commands per seconds sent via redisson. And we have some cronjobs that update information in the db (and cache). We are using redisson 3.12.3 with LocalCachedMap with the following options.

LocalCachedMapOptions.defaults()
        .evictionPolicy(LocalCachedMapOptions.EvictionPolicy.LRU)
        .syncStrategy(LocalCachedMapOptions.SyncStrategy.INVALIDATE)
        .timeToLive(ttlMinutes, TimeUnit.MINUTES);

The synchronization is working great. However, since the cronjob is setting up new connections then disconnects we often during the peak hours receive errors like so

2020-06-08 10:00:07,395 ERROR org.redisson.client.handler.CommandPubSubDecoder - Unable to decode data. channel: [id: 0x62858bf8, L:/10.y.y.y:50724 - R:xxx/10.x.x.x:6379], reply: ReplayingDecoderByteBuf(ridx=49, widx=49)
java.util.concurrent.RejectedExecutionException: Task org.redisson.client.handler.CommandPubSubDecoder$$Lambda$91/1018878170@65cec14d rejected from java.util.concurrent.ThreadPoolExecutor@41eae594[Shutting down, pool size = 10, active threads = 0, queued tasks = 0, completed tasks = 15]

        at java.util.concurrent.ThreadPoolExecutor$AbortPolicy.rejectedExecution(ThreadPoolExecutor.java:2063)
        at java.util.concurrent.ThreadPoolExecutor.reject(ThreadPoolExecutor.java:830)
        at java.util.concurrent.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:1379)
        at org.redisson.client.handler.CommandPubSubDecoder.enqueueMessage(CommandPubSubDecoder.java:171)
        at org.redisson.client.handler.CommandPubSubDecoder.decodeResult(CommandPubSubDecoder.java:127)
        at org.redisson.client.handler.CommandDecoder.decodeList(CommandDecoder.java:422)
        at org.redisson.client.handler.CommandDecoder.decode(CommandDecoder.java:377)
        at org.redisson.client.handler.CommandPubSubDecoder.decodeCommand(CommandPubSubDecoder.java:71)
        at org.redisson.client.handler.CommandDecoder.decode(CommandDecoder.java:134)
        at org.redisson.client.handler.CommandDecoder.decode(CommandDecoder.java:91)
        at io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:498)
        at io.netty.handler.codec.ReplayingDecoder.callDecode(ReplayingDecoder.java:366)
        at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:276)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:377)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:363)
        at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:355)
        at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:377)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:363)
        at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919)
        at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:163)
        at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:714)
        at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:650)
        at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:576)
        at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:493)
        at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989)
        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)

I'm thinking that we can either wait longer for the shutdown or configure the instance not to subscribe to updates? I realize that this might be a weird use case, I tried manually constructing the publish command but got lost somewhere in the command encoding. I'm thinking that ideally a new SyncStrategy that only publish invalidation, and doesn't listen to them, would be the best solution for us.

Activity

  1. added this to the 3.13.2 milestone on Jun 8, 2020
  2. modified the milestones: 3.13.2, 3.13.3 on Jul 3, 2020
  3. modified the milestones: 3.13.3, 3.13.4 on Aug 6, 2020
  4. modified the milestones: 3.13.4, 3.13.5 on Sep 4, 2020
  5. modified the milestones: 3.13.5, 3.13.6 on Sep 30, 2020
  6. modified the milestones: 3.13.6, 3.13.7 on Oct 14, 2020
  7. mrniko commented on Oct 17, 2020

    @mrniko
    Member

    I'll add try catch for RejectedExecutionException

  8. 55 remaining items

  9. added this to the 3.19.2 milestone on Jan 6, 2023
  10. modified the milestones: 3.19.2, 3.19.3, 3.19.4 on Feb 2, 2023
  11. modified the milestones: 3.19.4, 3.20.1 on Mar 2, 2023
  12. modified the milestones: 3.20.1, 3.20.2 on Mar 28, 2023
  13. modified the milestones: 3.21.0, 3.21.1 on May 1, 2023
  14. modified the milestones: 3.21.1, 3.21.2 on May 12, 2023
  15. modified the milestones: 3.21.2, 3.12.x on May 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions