Illustrates a bug with the shutdown process where RedisIndexedSessionRepository
will be shut down too late, causing
the cleanup job to trigger errors on shutdown.
To make the issue constantly reproducible, a component is inducing a voluntary delay in the stopping process after
RedisConnectionFactory
is closed. While this happens, the session cleanup job will still run and cause errors.
# Build it
mvn clean package
# Launch a local Redis
docker compose -f spring-session-shutdown-demo-compose.yml up -d
# Launch the app
java -jar target/spring-session-shutdown-demo.jar
# Interrupt it - the errors will show up in the log
^C
# Tear down infrastructure
docker compose -f spring-session-shutdown-demo-compose.yml down