You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Martin Grigorov (JIRA)" <ji...@apache.org> on 2017/05/01 19:38:04 UTC

[jira] [Resolved] (WICKET-6356) Clustering failover not working on Tomcat

     [ https://issues.apache.org/jira/browse/WICKET-6356?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Martin Grigorov resolved WICKET-6356.
-------------------------------------
       Resolution: Fixed
    Fix Version/s: 8.0.0-M6
                   7.7.0
                   6.27.0

I was able to reproduce the problem.
I've just added the following Apache2 conf to /etc/apache2/sites-enabled/tomcat-cluster.conf:

{code}
ProxyPass "/" "balancer://cluster/" stickysession=JSESSIONID nofailover=Off
ProxyPassReverse "/" "balancer://cluster/"

# define the balancer, with http and/or ajp connections
<Proxy balancer://cluster/>
       Order allow,deny
       Allow from all
       BalancerMember ajp://127.0.0.1:8009 route=gc1
       BalancerMember ajp://127.0.0.1:8010 route=gc2
  </Proxy>
{code}

The needed modules are: proxy_ajp.load, proxy_balancer.conf, proxy_balancer.load, proxy.conf, proxy_http.load, proxy.load, 
lbmethod_byrequests.load 

The version of Tomcat is 8.0.43. For 8.5.x MessageDispatch15Interceptor should be replaced with MessageDispatchInterceptor in server.xonf.
Also I've changed the receiver address to 127.0.0.1. 

[~waynegc] Please test my change with 7.7.0-SNAPSHOT and let me know if something is still broken!
Thank you very much for the discussion and analysis!

> Clustering failover not working on Tomcat
> -----------------------------------------
>
>                 Key: WICKET-6356
>                 URL: https://issues.apache.org/jira/browse/WICKET-6356
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 6.17.0, 7.5.0
>         Environment: Tomcat 8.0.32, Apache 2.4, OSx and Solaris 9,
>            Reporter: wayne pope
>            Assignee: Martin Grigorov
>              Labels: cluster, clustering, tomcat
>             Fix For: 6.27.0, 7.7.0, 8.0.0-M6
>
>         Attachments: IssueFiles.zip, PageStoreManager.java
>
>
> Clustering failover with Tomcat 8 is not working for us in Production or locally on my Mac. The reason is the following from the debugging that I did and from the best of my understanding:
> Whenever a statefull page is used/touched the SessionEntry is updated. This SessionEntry is stored in the tomcats session under the attribute name  "wicket:persistentPageManagerData-APPLICATION_NAME". 
> However at the end of the wicket request, Session.internalDetach() is called and setAttribute() is called passing the wicket session under the name "wicket:wicket.hub:session". This triggers the replication in Tomcat (only when setAttribute is called and ONLY that attribute is replicated). Because the SessionEntry is stored under a different attribute name its never replicated.
> The only time the SessionEntry is replicated is when a node first starts up and joins the cluster , at this point all sessions are replicated across (including all attritbutes) by the daltamanager and SessionEntry#readObject() is used which contains all the pages. On Tomcat after this initial syncing of all sessions SessionEntry#readObject() is never used.
> So the only time session failover works is when you kill the other instance (in a 2 node cluster) just after the other instance starts up - at this point the correct SessionEntry is on the new instance. If however you visit some more pages the new pages are never replicated across as the SessionEntry is never replicated.
> Further to this IF the SessionEntry was to be replicated it would not be any good as the cache are transient 
> private transient List<IManageablePage> sessionCache;
> private transient List<Object> afterReadObject
>  
> This means any new pages created on the old instance (after the new instance has started up) are not available in the http session or the second level page store on the new instance. 
> Therefore when the old instance in shut down the user is load balanced to the new instance. At this point the link in the page Wicket is looking for does not exist in the SessionEntry cache or the PageStore so it creates the page and looks for the component/link.This causes a ComponentNotFoundException for us because the links are either in a DataView which is never rendered so does not exist, or the other links are actually added to the page in an Ajax request and again because the page is not rendered are not there, Wicket then throws the exception and it appears to the user the session is lost.
> So in summary there seems there is no way for the current mechanism on Tomcat to work. It would seem the SessionEntry.sessionCache needs to be not transient and setAttribute needs to be called for the SessionEntry at the end of request on the internalDetach so that Tomcats deltamanager replicates that attribute in the session.
> Attached my quickstart , tomcat, and apache conf.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)