lettuce icon indicating copy to clipboard operation
lettuce copied to clipboard

RedisSubscription stucked in NO_DEMAND status

Open whojes-toss opened this issue 9 months ago • 3 comments

Bug Report

first of all, i'm not good at english so if something is vague or confusing, let me explain more.

Hi, my production code is stucked for some reason, so I'm investigating. It is really rare situation, and i cannot find reproduce, sorry about that.

so I captured heap dump files and found that one of RedisSubscription instance is in NO_DEMAND state, doing nothing. (the command was hvals.)

what i found:

  1. redisSubscription.command.output was empty but the element array size was 79 so i assumed that the hash had 79 elements at that time, and lettuce got them all. Image

  2. redisSubscription.data had 23 entries left. Image

  3. subscriber.delegate had 56 entries Image

  4. DEMAND value was 24, so last request(n) had been arrived. Image

And subscrition.request(n) is called sequentially with values of 32, 24, 24.


Here i assume:

this code block is saying that in order to move from subscription.data to upstream, onDataAvailable method has to be called when the state is DEMAND.

When my last request(24) signal was arrived, the state was NO_DEMAND, so NO_DEMAND.request was launched, but at this exact timing, somehow state was not DEMAND (maybe another thread made it NO_DEMAND again?), and the subscription never had moved forward.

Is that any possible?? if not, what should i look into, if you can advise. Thank you in advance!

Environment

  • Lettuce version(s): 6.2.7.RELEASE
  • Redis version: 6.0 cluster

whojes-toss avatar Mar 26 '25 13:03 whojes-toss

Or how about this timeline?

Image
boolean afterRead() {
    return changeState(State.READING, getDemand() > 0 ? State.DEMAND : State.NO_DEMAND);
}

this funtion choses to-be state and before actually changing it, between this gap, request(24) can be ignored.. i guess...

whojes-toss avatar Apr 01 '25 07:04 whojes-toss

Hey @whojes-toss ,

the team is quite busy right now, but we will get back to you as soon as possible.

tishun avatar Jun 03 '25 06:06 tishun

thanks for replying :)

whojes-toss avatar Jun 04 '25 03:06 whojes-toss