Skip to content

Concurrent modification of session stored in hsqldb can result in HsqlException: integrity constraint violation: unique constraint or index violation ; SPRING_SESSION_ATTRIBUTES_PK table: SPRING_SESSION_ATTRIBUTES #3626

@MFAshby

Description

@MFAshby

Describe the bug
Running a spring-boot web application using spring-session-jdbc: when spring-session-jdbc is configured to store the session in an hsql database, if two concurrent http requests are handled from the same user, and attempt to insert the same attribute into the session, they can fail with the following exception message:

HsqlException: integrity constraint violation: unique constraint or index violation ; SPRING_SESSION_ATTRIBUTES_PK table: SPRING_SESSION_ATTRIBUTES

To Reproduce
See Describe the bug

Expected behavior
Session attributes are inserted or updated similar to how they would be with an in-memory session; or if using another relational database which already has upsert query configured for session attribute, e.g. postgres and using PostgreSqlJdbcIndexedSessionRepositoryCustomizer

Sample
In progress.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions