spring-projects / spring-projects/spring-session
cleanupExpiredSessionsTask will never run again when exception ocurred in cleanUPExpiredSession method
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 1.9k
- Forks
- 1.2k
- Avg merge
- 4h 27m
- Merged PRs (30d)
- 55
Description
Describe the bug
In ReactiveRedisIndexedSessionRepository class, when cleanUpExpiredSession method has exception,like the following stacktrace,the interval task will terminated ,not run next time:
2025-06-20 15:35:18.138 [TID: N/A] [lettuce-eventExecutorLoop-3-1] ERROR reactor.core.publisher.Operators -Operator called default onErrorDropped org.springframework.dao.QueryTimeoutException: Redis command timed out; nested exception is io.lettuce.core.RedisCommandTimeoutException: Command timed out after 5 second(s) at org.springframework.data.redis.connection.lettuce.LettuceExceptionConverter.convert(LettuceExceptionConverter.java:70) Suppressed: reactor.core.publisher.FluxOnAssembly$OnAssemblyException: Assembly trace from producer [reactor.core.publisher.MonoError] : reactor.core.publisher.MonoNext$NextSubscriber.onError(MonoNext.java:93) io.lettuce.core.RedisPublisher$ImmediateSubscriber.onError(RedisPublisher.java:891) Error has been observed at the following site(s): *__MonoNext$NextSubscriber.onError ⇢ at io.lettuce.core.RedisPublisher$ImmediateSubscriber.onError(RedisPublisher.java:891) *__________________Flux.onErrorMap ⇢ at org.springframework.data.redis.connection.lettuce.LettuceReactiveRedisConnection.execute(LettuceReactiveRedisConnection.java:224) |_ Flux.next ⇢ at org.springframework.data.redis.connection.ReactiveKeyCommands.exists(ReactiveKeyCommands.java:176) |_ Mono.map ⇢ at org.springframework.data.redis.connection.ReactiveKeyCommands.exists(ReactiveKeyCommands.java:176) *___________________Flux.usingWhen ⇢ at org.springframework.data.redis.core.ReactiveRedisTemplate.doInConnection(ReactiveRedisTemplate.java:242) |_ Mono.from ⇢ at org.springframework.data.redis.core.ReactiveRedisTemplate.doCreateMono(ReactiveRedisTemplate.java:220) |_ Mono.then ⇢ at org.springframework.session.data.redis.ReactiveRedisIndexedSessionRepository.touch(ReactiveRedisIndexedSessionRepository.java:336)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in ReactiveRedisIndexedSessionRepository at cleanUpExpiredSession and inspect how cleanupExpiredSessionsTask is scheduled and how errors are propagated. Use the Redis timeout stack trace as the failure case; done means an exception during cleanup does not terminate the interval task and a later scheduled run still occurs.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, redis
- Domain
- backend, databases
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100