spring-projects / spring-projects/spring-session
Multiple sessions are created when SessionRepositoryFilter precede ShallowEtagHeaderFilter
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 1.9k
- Forks
- 1.2k
- Avg merge
- 4h 27m
- Merged PRs (30d)
- 55
Description
Multiple sessions are created when SessionRepositoryFilter precede ShallowEtagHeaderFilter. The reason being ShallowEtagHeaderFilter wraps the response with ShallowEtagResponseWrapper, which maintains an internal stream and commits the response just by copying the internal stream directly to the native httpresponse stream. Thus it bypass all HttpResponseWrappers in between including SessionRepositoryResponseWrapper, so the onResponseCommitted method is not getting called when the response is actually committed by ShallowEtagHeaderFilter.
When the control reaches SessionRepositoryFilter, response is already committed, so the newly added cookie header is not sent to the client. As a workaround, i moved SessionRepositoryFilter after ShallowEtagHeaderFilter in the filter chain and it works well.
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 the filter-chain ordering described for SessionRepositoryFilter and ShallowEtagHeaderFilter, focusing on how ShallowEtagResponseWrapper copies its internal stream to the native response. Compare that path with SessionRepositoryResponseWrapper and its onResponseCommitted handling. Done means the session cookie is sent and only one session is created when the filters are ordered as described.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, spring
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100