Skip to content

NullPointerException after invalidating session #1076

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
matthews614 opened this issue May 14, 2018 · 5 comments
Closed

NullPointerException after invalidating session #1076

matthews614 opened this issue May 14, 2018 · 5 comments
Assignees
Labels
Milestone

Comments

@matthews614
Copy link

I upgraded my application from Spring Boot 2.0.1 and Hazelcast 3.8.5 to Spring Boot 2.0.2 and Hazelcast 3.9.4. After doing so, I notice a NullPointerException when logging out.

I am using Spring Security and have a org.springframework.security.web.authentication.logout.SecurityContextLogoutHandler configured to invalidate the HttpSession after logout. During a logout, Spring Session is failing with this stack trace:

java.lang.NullPointerException: null
	at org.springframework.session.hazelcast.HazelcastSessionRepository$SessionUpdateEntryProcessor.process(HazelcastSessionRepository.java:455) ~[spring-session-hazelcast-2.0.3.RELEASE.jar:2.0.3.RELEASE]
	at com.hazelcast.map.impl.operation.EntryOperator.process(EntryOperator.java:335) ~[hazelcast-3.9.4.jar:3.9.4]
	at com.hazelcast.map.impl.operation.EntryOperator.operateOnKeyValueInternal(EntryOperator.java:194) ~[hazelcast-3.9.4.jar:3.9.4]
	at com.hazelcast.map.impl.operation.EntryOperator.operateOnKey(EntryOperator.java:179) ~[hazelcast-3.9.4.jar:3.9.4]
	at com.hazelcast.map.impl.operation.EntryOperation.runVanilla(EntryOperation.java:395) ~[hazelcast-3.9.4.jar:3.9.4]
	at com.hazelcast.map.impl.operation.EntryOperation.run(EntryOperation.java:177) ~[hazelcast-3.9.4.jar:3.9.4]
	at com.hazelcast.spi.impl.operationservice.impl.OperationRunnerImpl.run(OperationRunnerImpl.java:194) ~[hazelcast-3.9.4.jar:3.9.4]
	at com.hazelcast.spi.impl.operationexecutor.impl.OperationThread.process(OperationThread.java:120) ~[hazelcast-3.9.4.jar:3.9.4]
	at com.hazelcast.spi.impl.operationexecutor.impl.OperationThread.run(OperationThread.java:100) ~[hazelcast-3.9.4.jar:3.9.4]
	at ------ submitted from ------.(Unknown Source) ~[na:na]
	at com.hazelcast.spi.impl.operationservice.impl.InvocationFuture.resolve(InvocationFuture.java:127) ~[hazelcast-3.9.4.jar:3.9.4]
	at com.hazelcast.spi.impl.operationservice.impl.InvocationFuture.resolveAndThrowIfException(InvocationFuture.java:79) ~[hazelcast-3.9.4.jar:3.9.4]
	at com.hazelcast.spi.impl.AbstractInvocationFuture.get(AbstractInvocationFuture.java:155) ~[hazelcast-3.9.4.jar:3.9.4]
	at com.hazelcast.map.impl.proxy.MapProxySupport.executeOnKeyInternal(MapProxySupport.java:1073) ~[hazelcast-3.9.4.jar:3.9.4]
	at com.hazelcast.map.impl.proxy.MapProxyImpl.executeOnKeyInternal(MapProxyImpl.java:106) ~[hazelcast-3.9.4.jar:3.9.4]
	at com.hazelcast.map.impl.proxy.MapProxyImpl.executeOnKey(MapProxyImpl.java:674) ~[hazelcast-3.9.4.jar:3.9.4]
	at org.springframework.session.hazelcast.HazelcastSessionRepository.save(HazelcastSessionRepository.java:236) ~[spring-session-hazelcast-2.0.3.RELEASE.jar:2.0.3.RELEASE]
	at org.springframework.session.hazelcast.HazelcastSessionRepository.save(HazelcastSessionRepository.java:110) ~[spring-session-hazelcast-2.0.3.RELEASE.jar:2.0.3.RELEASE]
	at org.springframework.session.web.http.SessionRepositoryFilter$SessionRepositoryRequestWrapper.saveSession(SessionRepositoryFilter.java:377) ~[spring-session-core-2.0.3.RELEASE.jar:2.0.3.RELEASE]
	at org.springframework.session.web.http.SessionRepositoryFilter$SessionRepositoryRequestWrapper.commitSession(SessionRepositoryFilter.java:233) ~[spring-session-core-2.0.3.RELEASE.jar:2.0.3.RELEASE]
	at org.springframework.session.web.http.SessionRepositoryFilter$SessionRepositoryRequestWrapper.access$100(SessionRepositoryFilter.java:197) ~[spring-session-core-2.0.3.RELEASE.jar:2.0.3.RELEASE]
	at org.springframework.session.web.http.SessionRepositoryFilter.doFilterInternal(SessionRepositoryFilter.java:150) ~[spring-session-core-2.0.3.RELEASE.jar:2.0.3.RELEASE]
	at org.springframework.session.web.http.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:81) ~[spring-session-core-2.0.3.RELEASE.jar:2.0.3.RELEASE]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-8.5.31.jar:8.5.31]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-8.5.31.jar:8.5.31]
	at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:728) ~[tomcat-embed-core-8.5.31.jar:8.5.31]
	at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:472) ~[tomcat-embed-core-8.5.31.jar:8.5.31]
	at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:395) ~[tomcat-embed-core-8.5.31.jar:8.5.31]
	at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:316) ~[tomcat-embed-core-8.5.31.jar:8.5.31]
	at org.apache.catalina.core.StandardHostValve.custom(StandardHostValve.java:395) [tomcat-embed-core-8.5.31.jar:8.5.31]
	at org.apache.catalina.core.StandardHostValve.status(StandardHostValve.java:254) [tomcat-embed-core-8.5.31.jar:8.5.31]
	at org.apache.catalina.core.StandardHostValve.throwable(StandardHostValve.java:349) [tomcat-embed-core-8.5.31.jar:8.5.31]
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:175) [tomcat-embed-core-8.5.31.jar:8.5.31]
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81) [tomcat-embed-core-8.5.31.jar:8.5.31]
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87) [tomcat-embed-core-8.5.31.jar:8.5.31]
	at org.apache.catalina.valves.RemoteIpValve.invoke(RemoteIpValve.java:677) [tomcat-embed-core-8.5.31.jar:8.5.31]
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342) [tomcat-embed-core-8.5.31.jar:8.5.31]
	at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:803) [tomcat-embed-core-8.5.31.jar:8.5.31]
	at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) [tomcat-embed-core-8.5.31.jar:8.5.31]
	at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:790) [tomcat-embed-core-8.5.31.jar:8.5.31]
	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1468) [tomcat-embed-core-8.5.31.jar:8.5.31]
	at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) [tomcat-embed-core-8.5.31.jar:8.5.31]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_92]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_92]
	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-embed-core-8.5.31.jar:8.5.31]
	at java.lang.Thread.run(Thread.java:745) [na:1.8.0_92]
``

My guess is that the spring-session is attempting to update a session that has been invalidated. 
@vpavic vpavic self-assigned this May 14, 2018
@vpavic vpavic added this to the 2.0.4 milestone May 14, 2018
@vpavic
Copy link
Contributor

vpavic commented May 15, 2018

Thanks for the report @matthews614. This is a regression caused by #1048.

vpavic added a commit that referenced this issue May 15, 2018
This commit improves HazelcastSessionRepository.SessionUpdateEntryProcessor to avoid NPE in scenario where save operation was invoked for session that was already deleted.

See gh-1076
@vpavic vpavic closed this as completed in 6d02790 May 15, 2018
@vpavic
Copy link
Contributor

vpavic commented May 15, 2018

This was fixed in 6d02790. Fresh 2.0.4-BUILD-SNAPSHOT should we available in around half an hour, I'd appreciate if you could give it a spin.

@matthews614
Copy link
Author

Tested it out and it looks good on our end.

@Koizumi85
Copy link

Hey together. We have the same error here. Is there a timeline when you plan to release 2.0.4.RELEASE?

@vpavic
Copy link
Contributor

vpavic commented Jun 14, 2018

Hi @Koizumi85 - sorry for the late response, the 2.0.4.RELEASE was released yesterday. In general, you should find this information on project's milestones page.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants