Skip to content
This repository was archived by the owner on Apr 4, 2025. It is now read-only.
This repository was archived by the owner on Apr 4, 2025. It is now read-only.

Reactive WebSessions do not seem to get cleaned up in Mongo #226

Open
@zargarf

Description

@zargarf

Hi

I'm trying to swap out using spring-session-data-redis for spring-session-data-mongo in a Webflux spring-cloud-gateway.
Previously with the redis implementation session information in redis was correctly auto deleted after expiry. However with the reactive mongo implementation this does not seem to be happening, and old session data remains persisted forever.
I'm using spring-boot 3.1.5, webflux, reactive mongo with Oauth2 flows in spring-security.

Could someone please clarify whether these sessions are meant to be auto-cleaned up after their expiry? I don't see any additional date-related indices on the collection when the database is autocreated.

dependecies in pom:

  <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-data-mongodb-reactive</artifactId>
       <version>3.1.5</version>
    </dependency>
    <dependency>
      <groupId>org.springframework.session</groupId>
      <artifactId>spring-session-data-mongodb</artifactId>
      <version>3.1.3</version>
    </dependency>

Expected behavior

Expired sessions should be deleted from Mongodb

Actual behavior

Old sessions remain in Mongodb

Reactor Netty version: 1.1.12

JVM version (e.g. java -version): 20

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions