generator-jhipster: [Hazelcast http clustering] Session not found exceptions from Undertow

Overview of the issue

Session not found exceptions from Undertow

Im seeing the below stack trace in our travis mySQL build https://travis-ci.org/jhipster/generator-jhipster/jobs/161663710

2016-09-21 16:47:29.009 DEBUG 6243 --- [ XNIO-2 task-13] j.t.s.CustomPersistentRememberMeServices : Interactive login attempt was unsuccessful.
2016-09-21 16:47:29.009 DEBUG 6243 --- [ XNIO-2 task-13] j.t.s.CustomPersistentRememberMeServices : Cancelling cookie
2016-09-21 16:47:29.020 DEBUG 6243 --- [  XNIO-2 task-3] j.t.s.CustomPersistentRememberMeServices : Logout of user Unknown
2016-09-21 16:47:29.021 DEBUG 6243 --- [  XNIO-2 task-7] j.t.s.CustomPersistentRememberMeServices : Logout of user Unknown
2016-09-21 16:47:29.021 DEBUG 6243 --- [  XNIO-2 task-3] j.t.s.CustomPersistentRememberMeServices : Cancelling cookie
2016-09-21 16:47:29.021 DEBUG 6243 --- [  XNIO-2 task-7] j.t.s.CustomPersistentRememberMeServices : Cancelling cookie
2016-09-21 16:47:29.044 ERROR 6243 --- [  XNIO-2 task-3] io.undertow.request                      : UT005023: Exception handling request to /api/logout
java.lang.IllegalStateException: UT000010: Session not found 0_kVw84DPMlDFsX95cqknl_0i18SIgwEWO62IuEu
    at io.undertow.server.session.InMemorySessionManager$SessionImpl.removeAttribute(InMemorySessionManager.java:505)
    at io.undertow.servlet.spec.HttpSessionImpl.removeAttribute(HttpSessionImpl.java:183)
    at org.springframework.security.web.csrf.HttpSessionCsrfTokenRepository.saveToken(HttpSessionCsrfTokenRepository.java:59)
    at org.springframework.security.web.csrf.LazyCsrfTokenRepository.saveToken(LazyCsrfTokenRepository.java:71)
    at org.springframework.security.web.csrf.CsrfLogoutHandler.logout(CsrfLogoutHandler.java:53)
    at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:113)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
    at io.github.jhipster.travis.web.filter.CsrfCookieGeneratorFilter.doFilterInternal(CsrfCookieGeneratorFilter.java:34)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
    at org.springframework.security.web.csrf.CsrfFilter.doFilterInternal(CsrfFilter.java:124)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
    at org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:66)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
    at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:106)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
    at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:56)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
    at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:214)
    at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:177)
    at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)
    at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:262)
    at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
    at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
    at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
    at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
    at org.springframework.web.filter.HttpPutFormContentFilter.doFilterInternal(HttpPutFormContentFilter.java:89)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
    at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
    at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:77)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
    at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
    at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:197)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
    at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
    at io.undertow.servlet.handlers.FilterHandler.handleRequest(FilterHandler.java:84)
    at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62)
    at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36)
    at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:131)
    at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:57)
    at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
    at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:46)
    at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:64)
    at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:60)
    at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:77)
    at io.undertow.security.handlers.AbstractSecurityContextAssociationHandler.handleRequest(AbstractSecurityContextAssociationHandler.java:43)
    at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
    at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
    at io.undertow.servlet.handlers.SessionRestoringHandler.handleRequest(SessionRestoringHandler.java:119)
    at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:285)
    at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:264)
    at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:81)
    at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:175)
    at io.undertow.server.Connectors.executeRootHandler(Connectors.java:207)
    at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:802)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
2016-09-21 16:47:29.061 ERROR 6243 --- [  XNIO-2 task-3] io.undertow.request                      : UT005022: Exception generating error page /error
org.springframework.web.util.NestedServletException: Request processing failed; nested exception is java.lang.IllegalStateException: UT000010: Session not found 0_kVw84DPMlDFsX95cqknl_0i18SIgwEWO62IuEu
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:982)
    at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:872)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
    at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
    at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:85)
    at io.undertow.servlet.handlers.FilterHandler.handleRequest(FilterHandler.java:81)
    at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62)
    at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36)
    at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
    at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
    at io.undertow.servlet.handlers.SessionRestoringHandler.handleRequest(SessionRestoringHandler.java:119)
    at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:266)
    at io.undertow.servlet.handlers.ServletInitialHandler.dispatchToPath(ServletInitialHandler.java:201)
    at io.undertow.servlet.spec.RequestDispatcherImpl.error(RequestDispatcherImpl.java:462)
    at io.undertow.servlet.spec.RequestDispatcherImpl.error(RequestDispatcherImpl.java:395)
    at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:312)
    at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:264)
    at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:81)
    at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:175)
    at io.undertow.server.Connectors.executeRootHandler(Connectors.java:207)
    at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:802)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.IllegalStateException: UT000010: Session not found 0_kVw84DPMlDFsX95cqknl_0i18SIgwEWO62IuEu
    at io.undertow.server.session.InMemorySessionManager$SessionImpl.getAttribute(InMemorySessionManager.java:472)
    at io.undertow.servlet.spec.HttpSessionImpl.getAttribute(HttpSessionImpl.java:122)
    at org.springframework.web.servlet.support.SessionFlashMapManager.retrieveFlashMaps(SessionFlashMapManager.java:46)
    at org.springframework.web.servlet.support.AbstractFlashMapManager.retrieveAndUpdate(AbstractFlashMapManager.java:93)
    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:889)
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970)
    ... 24 common frames omitted
2016-09-21 16:47:29.092 DEBUG 6243 --- [  XNIO-2 task-5] i.g.j.travis.aop.logging.LoggingAspect   : Enter: org.springframework.boot.actuate.audit.AuditEventRepository.add() with argument[s] = [AuditEvent [timestamp=Wed Sep 21 16:47:29 UTC 2016, principal=anonymousUser, type=AUTHORIZATION_FAILURE, data={details=org.springframework.security.web.authentication.WebAuthenticationDetails@fffc7f0c: RemoteIpAddress: 127.0.0.1; SessionId: TBO4ZoblVjIjtgUBqgA1FTTTNMMgBslxxyuS7hG9, type=org.springframework.security.access.AccessDeniedException, message=Access is denied}]]
2016-09-21 16:47:29.093 DEBUG 6243 --- [  XNIO-2 task-5] i.g.j.travis.aop.logging.LoggingAspect   : Exit: org.springframework.boot.actuate.audit.AuditEventRepository.add() with result = null
2016-09-21 16:47:29.094 DEBUG 6243 --- [  XNIO-2 task-5] i.g.j.t.s.Http401UnauthorizedEntryPoint  : Pre-authenticated entry point called. Rejecting access
.[16:47:30] W/element - more than one element found for locator By(css selector, button[type=submit]) - the first result will be used
2016-09-21 16:47:30.438 DEBUG 6243 --- [  XNIO-2 task-4] i.g.j.t.security.UserDetailsService      : Authenticating admin
Hibernate: select user0_.id as id1_24_, user0_.created_by as created_2_24_, user0_.created_date as created_3_24_, user0_.last_modified_by as last_mod4_24_, user0_.last_modified_date as last_mod5_24_, user0_.activated as activate6_24_, user0_.activation_key as activati7_24_, user0_.email as email8_24_, user0_.first_name as first_na9_24_, user0_.lang_key as lang_ke10_24_, user0_.last_name as last_na11_24_, user0_.login as login12_24_, user0_.password_hash as passwor13_24_, user0_.reset_date as reset_d14_24_, user0_.reset_key as reset_k15_24_ from jhi_user user0_ where user0_.login=?
2016-09-21 16:47:30.541 DEBUG 6243 --- [  XNIO-2 task-4] i.g.j.travis.aop.logging.LoggingAspect   : Enter: org.springframework.boot.actuate.audit.AuditEventRepository.add() with argument[s] = [AuditEvent [timestamp=Wed Sep 21 16:47:30 UTC 2016, principal=admin, type=AUTHENTICATION_SUCCESS, data={details=org.springframework.security.web.authentication.WebAuthenticationDetails@fffc7f0c: RemoteIpAddress: 127.0.0.1; SessionId: TBO4ZoblVjIjtgUBqgA1FTTTNMMgBslxxyuS7hG9}]]
Hibernate: insert into jhi_persistent_audit_event (event_id, event_date, event_type, principal) values (null, ?, ?, ?)
2016-09-21 16:47:30.546 DEBUG 6243 --- [  XNIO-2 task-4] i.g.j.travis.aop.logging.LoggingAspect   : Exit: org.springframework.boot.actuate.audit.AuditEventRepository.add() with result = null
Hibernate: insert into jhi_persistent_audit_evt_data (event_id, name, value) values (?, ?, ?)
Hibernate: insert into jhi_persistent_audit_evt_data (event_id, name, value) values (?, ?, ?)
2016-09-21 16:47:30.551 DEBUG 6243 --- [  XNIO-2 task-4] j.t.s.CustomPersistentRememberMeServices : Creating new persistent login for user admin
Reproduce the error

https://travis-ci.org/jhipster/generator-jhipster/jobs/161663710

Related issues

Might be related to some of the twitter comments earlier from some user

JHipster Version(s)

Master

JHipster configuration, a .yo-rc.json file generated in the root folder

mySQL travis build

Entity configuration(s) entityName.json files generated in the .jhipster directory

mySQL travis build

Browsers and Operating System

Linux, travis

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 56 (41 by maintainers)

Most upvoted comments

By the way, please note we have 3 use cases: 1) only http session clustering, 2) only Hibernate 2nd level cache and 3) both http session clustering and Hibernate 2nd level cache

Ok, after spending some time with jhipster, I can say that most sustainable way to cover all 3 use cases is to externalize HazelcastInstance creation to separate config bean

like here https://github.com/gAmUssA/jhipster-hazelcast-reference-impl/commit/fc647e6faa4882eb8d2ea4f158f496732134b1c5

Now we have 3 separate configs:

  • HazelcastConfig.java - creates HazelcastInstance. BTW, in some cases the user might want to create client instance instread of member’s instance.
  • DatabaseConfig.java, actually this one is nothing to do with Hazelcast or Hibernate. Spring constructs the beans from application-env.yml
  • CachingConfig.java - purpose of this is enable spring caching abstration that works with HazelcastCacheManager.
  • WebConfigurer.java - websession clustering.

As you might notice, I think, there is a 4th use case - method result caching <- see CachingConfig.java with @EnableCaching and HazelcastCacheManager.

Thoughts?

I’ve tried to upgrade Hazelcast, and as always this is very painful, and not working.

So I’ve spent a lot of time of Hazelcast session clustering, and I’m not sure this is useful:

  • We clearly push to have stateless apps
  • In my stats, only 1,3 % of people are using it (that’s from the anonymous stats - turn them on if you want your vote to count!)

I’m going to do a quick Twitter survey on this, and ask about it in the dev mailing list, but I don’t want to be blocked by it, so currently I’m thinking of removing it in the next release.

I got the similar exception when upgraded the JHipster version from 3.6.0(tomcat) to 3.10.0(undertow). Had to update pom.xml to use tomcat instead of undertow to make the error go away.

As the occurrence of this exception is very unpredictable or random, I am having difficulty to debug this. It would be good to have a permanent solution to it.