RedisSubscription stucked in NO_DEMAND status
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:
-
redisSubscription.command.outputwas 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. -
redisSubscription.datahad 23 entries left. -
subscriber.delegatehad 56 entries -
DEMAND value was 24, so last request(n) had been arrived.
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
Or how about this timeline?
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...
Hey @whojes-toss ,
the team is quite busy right now, but we will get back to you as soon as possible.
thanks for replying :)