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

Created on 22 Sep 2016  Â·  56Comments  Â·  Source: jhipster/generator-jhipster

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

area minor

All 56 comments

@jdubois we didn't have this with tomcat could this be an undertow issue? could this be related to http://stackoverflow.com/questions/39570416/getting-illegalstateexception-after-upgrading-jhipster-3-7

@deepu105 Actually it's very annoying, for example if you have one call in page load and jhipster has one call for get the current account, sometimes checking logged in account connection drops and you will sign out from account and if you refresh the page because this time the connection got status 200 you are logged in. Do you have anything in your mind to help me fix it?

We will be looking into this. Follow this tread for updates. Meanwhile you
can try to package a war and deploy in tomcat and check if you have the
same issue there

Thanks & regards,
Deepu

On 23 Sep 2016 03:41, "Navid Ghahremani" [email protected] wrote:

@deepu105 https://github.com/deepu105 Actually it's beery annoying, for
example if you have one call in page load and jhipster has one call for get
the current account, sometimes checking logged in account connection drops
and you will sign out from account and if you refresh the page because this
time the connection got status 200 you are logged in. Do you have anything
in your mind to help me fix it?

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/jhipster/generator-jhipster/issues/4189#issuecomment-249043200,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABDlF4hdjyVNA_5yOvwsgFvcndDZzhLJks5qsv0bgaJpZM4KDoh0
.

Problem only with hazelcast ...

Seems like an undertow / wildfly issue :

Wildfly issue / Hazelcast

I tried without hazel, everything works fine

@ghahramani are you also using Hazelcast?
I did a quick test with the default app, using 1,000 concurrent users (doing a Gatling test with a default entity), I had absolutely no issue.

@jdubois Yes, I'm using it for clustered http session. What happens if I remove hazel cast? Should I expect any strange behavior because it's not clustered http session anymore?

@ghahramani of course, everything that you put in the session won't be synchronized anymore... Why, did you select the option without knowing what it does? In that case you can probably remove it without any issues.

I renamed the issue to show it's only occurring with Hazelcast HTTP clustering (so that's quite minor in fact)

@jdubois I know what clustered http session is, I'm not using session in my project actually I'm using but I can remove it, I asked the question to know, Is jhipster using it in the project by default when I select the option?

Sorry @ghahramani -> no we're not doing anything specific with it, so you can remove it

@jdubois Ok, Thanks. Do you have any plan to fix this problem in next release or you will solve it later?

I'd love to solve it, but I don't have the time right now, and it only affects a few percentage of users, so it's not urgent for me.
It could be quite serious, so I'm keeping this opened, I hope someone will have the time to look at it.

This issue occurred to me as well in an environment generated with the latest generator consisting of a registry, gateway and uaa (all run in production environments; mvnw -Pprod).
Might be related to the Hazelcast multicast settings? It doesnt seem to happen in a dev environment with a TCP/IP hazelcast config.

Ill try and setup a reproducible scenario tonight.

@berndvdveen I removed clustered Hazelcast and it works like a charm but unfortunately it exists when the hazelcast is being used

@ghahramani Thank you for your response. Removing clustered Hazelcast might alleviate the problem, it doesn't solve it.

My best guess after a short investigation is that because multiple subsequent calls are made (for example when logging in, adding a entity in the UI etc.) to different microservices (UAA for login and a different microservice for the entity) that the hazelcast goes out of sync.

It depends on how Ribbon is configured but configuring the Hazelcast WebFilter to disable sticky-sessions might work (default is true)

Hazelcast web session replication

@berndvdveen yes exactly but it happened after using undertow, I didn't have this problem in tomcat, I think it should related to undertow too.

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.

With regards to #4453 - we are not using undertow. We get the error quite often (perhaps 1 in 100 requests?) and the configuration is Apache from 5.6-apache (2.4.10) / Tomcat from 8.5-jre8.

thanks @Andaav ... so the issue would be just with Hazelcast? Like their filter isn't working properly?

@jdubois sorry this goes way over my competence level :)

OK this looks like an Hazelcast issue, at least I'm going to update its version:

  • This is needed by @henri-tremblay on #4454 anyway
  • Hopefully the issue is corrected in this new release

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.

So eventually I did the upgrade to Hazelcast 3.7 :
https://github.com/jhipster/generator-jhipster/commit/dd8d84ff70d7c426296516065890af30d18cbb1a

The code I originally did is a bit tricky, as it looks like Hazelcast didn't think of people who would use HTTP Session clustering AND Hibernate 2nd level cache at the same time. And this is what is mostly causing issues. Without session clustering, our code would be much simpler & easier to maintain.

The good news is that I met on Twitter @gAmUssA -> Viktor, maybe you could have a look at this specific issue? Hopefully the upgrade will have solved it.

As @gAmUssA looks interested:

@gAmUssA and then of course the goal is to solve https://github.com/jhipster/generator-jhipster/pull/4454 but for me we should first upgrade to the latest version cleanly

@jdubois couple questions / notes

I will try to create example app that will reuse same Hazelcast instance for Hibernate L2 cache and WebSession replication.

@jdubois bullet point 3 in your question - what's desired behaviour?

For Ehcache, because of the way JCache, Hibernate and Spring works, I had to use a SpringCacheRegionFactory to have the same CacheManager for both Spring and Hibernate.

We should be able to load Hazelcast using JCache and get only one CacheManager.

@gAmUssA thanks for your comments!

  • This code is in fact quite old. I coded this for myself, a long time before Spring Boot existed, and probably for Hazelcast 2.x. And since then nobody touched it. So it can definitely be improved -> if you can remove or improve it, that's perfectly normal, and don't hesitate to do so.
  • My expected behavior is that Hazelcast isn't lazy-loaded. The main use case is the Hibernate 2nd level cache, so this is what is driving the use case.
  • 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

@henri-tremblay Hazelcast has integration with Hibernate5 and 5.2. It requires Hazelcast 3.7
Also in Hibernate 5 they introduced JCacheRegionFactory. Going forward I think it would be more sense standardize on JCache.

@jdubois

My expected behavior is that Hazelcast isn't lazy-loaded

We can start HazelcastInstance during Spring context initialization. After that instance can be injected using @Autowired or @Inject.
Correct?
I can craft a reference example with jhipster and Hazelcast.
And after we can see how those changes can be incorporated into the generator. Deal?

p.s. I see another caching use case here - Spring Caching Abstraction (@EnableCaching and etc) for caching methods results.

Thanks. I will upgrade to 3.7 and hibernate52-1.1.1

On 10 November 2016 at 16:02, Viktor Gamov [email protected] wrote:

@henri-tremblay https://github.com/henri-tremblay Hazelcast has
integration with Hibernate5 and 5.2
https://github.com/hazelcast/hazelcast-hibernate5. It requires
Hazelcast 3.7
Also in Hibernate 5 they introduced
http://docs.jboss.org/hibernate/orm/5.2/userguide/html_single/Hibernate_User_Guide.html#caching-provider-jcache
JCacheRegionFactory. Going forward I think it would be more sense
standardize on JCache.

@jdubois https://github.com/jdubois

My expected behavior is that Hazelcast isn't lazy-loaded

We can start HazelcastInstance during Spring context initialization.
After that instance can be injected using @Autowired or @Inject.
Correct?
I can craft a reference example with jhipster and Hazelcast.
And after we can see how those changes can be incorporated into the
generator. Deal?

p.s. I see another caching use case here - Spring Caching Abstraction (
@EnableCaching and etc) for caching methods results.

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/jhipster/generator-jhipster/issues/4189#issuecomment-259712427,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABKRM2WCifKyZhqlSLO97nX5K3FpZN4wks5q8zIMgaJpZM4KDoh0
.

@henri-tremblay I've already upgraded to 3.7 in master :-)

@gAmUssA yes the Spring Cache abstraction is another good use case: we don't provide it just because it's too simple (there is no added value, see Policy 2, but I guess many people want this. And it would indeed be simpler if that was a Spring Bean - I think there is already a Spring Boot starter for that, by the way. So, yes, deal!

@jdubois implemented your requirements

https://github.com/gAmUssA/jhipster-hazelcast-reference-impl/commit/c87b285cf6a73453ba6cf3c1c3d806d7529a1d78 - check commit message and diff

Let me know if you have any questions.
If you're ok with this implementation I will go ahead and send PR for generator.
After that we can upgrade with @henri-tremblay changes

Thank you

Thanks @gAmUssA

  • We added quite a few comments
  • But overall this looks really good
  • And lots of lines deleted!!! Great!

If you struggle with our templates, don't hesitate to do an incomplete PR, we will help you, no problem.

Indeed. And this will be really helpful for me. When do you think it can be merged?

@henri-tremblay I won't be much available to work on JHipster next week, so that would be at least the week after

@henri-tremblay I will work on PR tomorrow.

Thanks. I merge it into mine to see how it goes. Your code is much simpler than the actual one.

With the latest 3.11.0 release we have now upgraded to Hazelcast 3.7, so hopefully this is solved.
Unfortunately we have no way to reproduce, so please add comments if you still have this!!!

@gAmUssA How is the PR going?

@henri-tremblay working on it as we speak.
@jdubois how do you guys test it locally?

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'll check tomorrow.

About testing. You can use npm test to have some testing on the generation.

Then, they have samples of different generations. I did a PR to add a script to run them easily. Because I wasn't able to test just like you

Yes, the 4th use case with @EnableCaching is very important: we don't generate this because it's really easy to add (so this would be against Policy 2), but that's a totally valid and commonly used feature.
So +1 from me!

@jdubois what about external Hazelcast configuration?

What do you mean by "external"? In a configuration file, like ehcache? In
that case yes, it would be similar to ehcache, so no problem.

Le 17 nov. 2016 2:19 AM, "Viktor Gamov" [email protected] a écrit :

@jdubois https://github.com/jdubois what about external Hazelcast
configuration?

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/jhipster/generator-jhipster/issues/4189#issuecomment-261126076,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AATVo9lKpNExAyUoe67YYU7HN717M39rks5q-6uqgaJpZM4KDoh0
.

this issue still persist in version 3.12.0

@japharr thanks for your comment but if you don't add any information, it does not help.

@japharr kindly provide the steps to reproduce. Thank you

We also updated Hazelcast (without updating jhipster, still running 3.0.6). Tomcat still randomly replies with an error 500 and with references to session management in the logs. Can't really provide steps to reproduce as it seems to be completely random.

There needs to be an explanation... Not sure this is a JHipster issue, as
we have just a basic configuration, and it was done by people working at
Hazelcast.
Did you contact Hazelcast support? I guess they're the best to find the
issue here.

Le 22 déc. 2016 8:48 AM, "Andaav" notifications@github.com a écrit :

We also updated Hazelcast (without updating jhipster, still running
3.0.6). Tomcat still randomly replies with an error 500. Can't really
provide steps to reproduce as it seems to be completely random.

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/jhipster/generator-jhipster/issues/4189#issuecomment-268739423,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AATVo6RZs1MYZvqdTv5SwVaO0g6Cch7mks5rKitLgaJpZM4KDoh0
.

@Andaav could you share a reproducer? If it's Hazelcast problem I'm pretty sure I will be able to tackle it.

Experienced this issue today. As I workaround, I removed the session cookies in an interceptor:

$cookies.remove('JSESSIONID', {path: "/"});
$cookies.remove('hazelcast.sessionId', {path: "/"});

Works for my situation because I want a stateless REST API anyway. Hazelcast is just in the mix for data caching.

We had same problem, as it was hard to reproduce and debug just tried to get rid of these session IDs and commented out these lines in configuration:

config.getMapConfigs().put("clustered-http-sessions", initializeClusteredSession(jHipsterProperties));

initClusteredHttpSessionFilter(servletContext, disps);

I'm sorry but this is definitely not helping: if you don't need clustered HTTP sessions, why on earth did you select this option?
I'm starting to believe there is no bug at all here, just people confused with the option.

As there has been a huge refactor and a version upgrade since the original ticket, if you still have an issue here (and know what "clustered http session" means, for instance that your classes must be Serializable), then please create a new ticket with your full configuration, as required by the project guidelines.
I'm locking this specific ticket, as this is just going nowhere.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

cmoine picture cmoine  Â·  57Comments

tibistibi picture tibistibi  Â·  82Comments

loydjayme25 picture loydjayme25  Â·  71Comments

deepu105 picture deepu105  Â·  81Comments

pochadri picture pochadri  Â·  61Comments