Skip to content

Restore Redis-backed HTTP sessions on Spring Boot 4 - #12530

Merged
dippindots merged 3 commits into
cBioPortal:masterfrom
dippindots:fix-spring-session-redis
Nov 26, 2026
Merged

dippindots merged 3 commits into
cBioPortal:masterfrom
dippindots:fix-spring-session-redis

Conversation

@dippindots

@dippindots dippindots commented Nov 24, 2026 •

Copy link
Copy Markdown
Collaborator

Problem

Since the Spring Boot 4.1 migration (#12361, released in 7.2.4), --spring.session.store-type=redis and --spring.data.redis.* no longer do anything. Boot 4 moved Spring Session's Redis autoconfiguration (SessionDataRedisAutoConfiguration) into its own module, spring-boot-session-data-redis. Our pom.xml has spring-session-data-redis but not that module, so Spring Session never starts and Tomcat keeps sessions in each pod's memory.

Symptoms on 7.2.7:

  • The session cookie is JSESSIONID instead of SESSION. Check with curl -sD- -o /dev/null https://<host>/saml2/authenticate/cbio-saml-idp | grep -i set-cookie.
  • SAML login fails with /login?error ("Invalid credentials") on deployments with more than one replica. The AuthnRequest is saved in one pod's session, and the IdP's response often reaches another pod.
  • On single-replica deployments users are logged out whenever the pod restarts.

Change

Add org.springframework.boot:spring-boot-session-data-redis. The version comes from the Boot parent (4.1.0).

Also moves the netty.version override from 4.1.137.Final to 4.2.21.Final. With Redis sessions active, Spring Session writes through Lettuce 7.5, which needs Netty 4.2 (io.netty.channel.MultiThreadIoEventLoopGroup). The old 4.1 pin downgraded Boot 4's managed Netty 4.2.15, and on msk beta every session save failed with NoClassDefFoundError (HTTP 500). 4.2.21.Final is the newest 4.2 release, at or above both Boot (4.2.15) and Redisson 4.7.0 (4.2.16), so the CVE override still holds.

Deployments that don't set spring.session.store-type are unchanged: AutoconfigureExcludeConfig.Redis still excludes DataRedisAutoConfiguration for them, so there's no Redis connection for sessions to use, the same as on 7.2.3.

Testing

  • mvn dependency:tree resolves spring-boot-session-data-redis:4.1.0 and spring-boot-session:4.1.0
  • Deploy to msk beta with 2 replicas: the cookie should be SESSION, and SAML login should work on every try
    Also updates OPEN-SOURCE-DOCUMENTATION and bom.json for the new dependencies (spring-boot-session, spring-boot-session-data-redis, and Netty 4.2.21.Final). The reports were refreshed on master in Regenerate third-party dependency reports #12532.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

Boot 4 moved Spring Session's Redis autoconfiguration into spring-boot-session-data-redis. Without it, --spring.session.store-type=redis has no effect and each pod keeps sessions in memory, which breaks SAML login on deployments with more than one replica.
Lettuce 7.5 (the Redis client behind Spring Session) needs Netty 4.2 (io.netty.channel.MultiThreadIoEventLoopGroup). The 4.1.137.Final pin from the Boot 3.5 era downgraded Boot 4's managed Netty 4.2.15 and broke every session write with NoClassDefFoundError. 4.2.21.Final is the newest 4.2 release and also covers Redisson 4.7.0 (built on 4.2.16).
Adds spring-boot-session and spring-boot-session-data-redis, and moves
the Netty artifacts to 4.2.21.Final.
@dippindots
dippindots force-pushed the fix-spring-session-redis branch from b1a9504 to 9d6905c Compare November 26, 2026 00:06
@dippindots
dippindots merged commit 789da6e into cBioPortal:master Nov 26, 2026
27 checks passed
@dippindots
dippindots deleted the fix-spring-session-redis branch November 26, 2026 00:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cl-bug Bug section of changelog. Bug fix dependencies

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants