Skip to content

Handler method is called twice when synchronizeOnSession is true in RequestMappingHandlerAdaptor [SPR-14136] #18708

@spring-projects-issues

Description

@spring-projects-issues

Joey Bartram opened SPR-14136 and commented

When synchronizeOnSession is turned on, the controller method is invoked twice.
Here is the snippet from RequestMappingHandlerAdaptor (lines 720-731).
Notice mav is set once and then set again before being returned.

// Execute invokeHandlerMethod in synchronized block if required.
if (this.synchronizeOnSession) {
HttpSession session = request.getSession(false);
if (session != null) {
Object mutex = WebUtils.getSessionMutex(session);
synchronized (mutex) {
mav = invokeHandlerMethod(request, response, handlerMethod);
}
}
}

mav = invokeHandlerMethod(request, response, handlerMethod);


Affects: 4.2.5

Issue Links:

Metadata

Metadata

Assignees

Labels

in: webIssues in web modules (web, webmvc, webflux, websocket)status: duplicateA duplicate of another issue

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions