spring-projects / spring-projects/spring-session
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
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 1.9k
- Forks
- 1.2k
- Avg merge
- 4h 27m
- Merged PRs (30d)
- 55
Description
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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing concurrent requests against a Spring Session JDBC store using HSQLDB, as described in the issue. Compare the session-attribute insert behavior with the PostgreSQL upsert configuration; done means concurrent requests updating the same attribute no longer produce a unique-constraint violation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 40/100