Skip to content

ReactiveRedisOperationsSessionRepository logout race condition with NullPointerException in findById #1111

@haizz

Description

@haizz

Using Spring Boot 2.0.3 with reactive WebFlux and spring-session-data-redis 2.0.4.

  1. Suppose we have a long-running web request (for example, WebSocket).
  2. Execute logout operation while long-running request 1 is still running.
  3. Session changes its key in Redis.
  4. When request 1 finishes an operation to save session delta will be executed.
  5. ReactiveRedisOperationsSessionRepository saves changed fields (for example, lastAccessedTime) USING OLD SESSION KEY.
  6. So now we have OLD SESSION KEY back in Redis having only one field: lastAccessedTime.
  7. Any new request which uses OLD SESSION KEY fails in ReactiveRedisOperationsSessionRepository.findById with NullPointerException in SessionMapper because all other fields like creationTime are missing.
  8. Panic ensues.

EDIT: Created related Spring Framework issue: https://jira.spring.io/browse/SPR-17051

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions