Re: [rap-dev] Various issues running RAP in a clustered envorinment
Hi Clemens, sorry for the late response, but it's summer time and most of as are on vacation. RAP dev mailing list is for RAP project development discussions. Please post your questions in RAP Newsgroup [1]. As you already mentioned, the clustering environment is tricky. On the Newsgroup you will get help from other RAP users with similar problems faster. [1] https://www.eclipse.org/forums/index.php?t=thread_id=34 Best regards, Ivan On 7/26/2017 11:35, Clemens Eisserer wrote: Hello, I wonder, is anybody using RAP on a session-replicated cluster? For the last few days I was trying to get my RAP based project to play nicely in a clustered environment. However, after fixing all the application-related issues, I still see strange behaviour, most likely caused by RAP. The environment is rather tricky: 2x Tomcat application servers + Apache+mod_jk round-robin load balancer The load-balancer is alternating between the two Tomcat instances for every request, which means high requirements regarding session replication consistency. Unfourtunately the environment is as-is, later the application has to run in an environment behaving like this one. RAP is configured with OperationMode.SESSION_FAILOVER and and in principle, session replication seems to work. Tomcat was configured with SimpleTcpCluster and channelSendOptions="6" (synchrounous session replication with ACK - according to the tomcat users mailing list the strictest setting Tomcat has.). However even with the simple example below, I get strange behaviour and issues: https://youtu.be/p5u2z-NjIs0 Sometimes request/response pairs are sent for 30s. And for a larger real-world app I also get sometimes: - HTTP-500 and HTTP-412 - ConcurrentModificationException during Session Serialization (Collection is modified concurrently while being serialized) - Various other exceptions listed below. - ClientListener is not Serializeable I had a look at RAP's source, but I am a bit lost: * ClientListener not implementing Serializeable was easy to fix and seems to work. * I guess the ConcurrentModificationException during seerialization is tough and it seems I am not the only one expoeriencing this: https://www.eclipse.org/forums/index.php/t/532053/ I wrote my own servlet filter (running before/after RWTClusterSupport) serializing all session attributes to disk, *removing* the attributes, and re-loading them again at the next request and ran into issues of UISessionImpl.attributes beeing empty. I saw UISessionImpl.get/setAttribute is synchronized, is this supposed to be accessed by multiple threads? If so, synchronization has no effect on the app servers synchronization during session replication - it will simply snapshot some inconsistent state). * What could cause the client to immediatly re-execute a new request after receiving a response? Maybe this could be a starting point to debug the request/response storms I am experiencing. Thank you in advance and best regards, Clemens public class BasicEntryPoint extends AbstractEntryPoint { protected void createContents(Composite parent) { Tree tree; ScrolledComposite scroll = new ScrolledComposite(parent, SWT.V_SCROLL); tree = new Tree(scroll, SWT.BORDER); scroll.setContent(tree); scroll.setExpandHorizontal(true); scroll.setExpandVertical(true); tree.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent se) { if(tree.getSelectionCount() > 0) { TreeItem item = tree.getSelection()[0]; item.setText(item.getText() + "_"); }} }); for(int i=0; i < 10; i++) { TreeItem item = new TreeItem(tree, SWT.NONE); item.setText("MainItem " + i); for(int m=0; m < 10; m++) { TreeItem childItem = new TreeItem(item, SWT.NONE); childItem.setText("Child: "+m); } } } } Tomcat cluster configuration: - java.lang.NullPointerException at org.eclipse.rap.rwt.SingletonUtil.getUniqueInstance(SingletonUtil.java:74) at org.eclipse.rap.rwt.internal.lifecycle.RequestCounter.getInstance(RequestCounter.java:25) at org.eclipse.rap.rwt.internal.service.LifeCycleServiceHandler.isRequestCounterValid(LifeCycleServiceHandler.java:133) at org.eclipse.rap.rwt.internal.service.LifeCycleServiceHandler.processUIRequest(LifeCycleServiceHandler.java:94) at org.eclipse.rap.rwt.internal.service.LifeCycleServiceHandler.synchronizedService(LifeCycleServiceHandler.java:75) at org.eclipse.rap.rwt.internal.service.LifeCycleServiceHandler.service(LifeCycleServiceHandler.java:66) at
[rap-dev] Various issues running RAP in a clustered envorinment
Hello, I wonder, is anybody using RAP on a session-replicated cluster? For the last few days I was trying to get my RAP based project to play nicely in a clustered environment. However, after fixing all the application-related issues, I still see strange behaviour, most likely caused by RAP. The environment is rather tricky: 2x Tomcat application servers + Apache+mod_jk round-robin load balancer The load-balancer is alternating between the two Tomcat instances for every request, which means high requirements regarding session replication consistency. Unfourtunately the environment is as-is, later the application has to run in an environment behaving like this one. RAP is configured with OperationMode.SESSION_FAILOVER and and in principle, session replication seems to work. Tomcat was configured with SimpleTcpCluster and channelSendOptions="6" (synchrounous session replication with ACK - according to the tomcat users mailing list the strictest setting Tomcat has.). However even with the simple example below, I get strange behaviour and issues: https://youtu.be/p5u2z-NjIs0 Sometimes request/response pairs are sent for 30s. And for a larger real-world app I also get sometimes: - HTTP-500 and HTTP-412 - ConcurrentModificationException during Session Serialization (Collection is modified concurrently while being serialized) - Various other exceptions listed below. - ClientListener is not Serializeable I had a look at RAP's source, but I am a bit lost: * ClientListener not implementing Serializeable was easy to fix and seems to work. * I guess the ConcurrentModificationException during seerialization is tough and it seems I am not the only one expoeriencing this: https://www.eclipse.org/forums/index.php/t/532053/ I wrote my own servlet filter (running before/after RWTClusterSupport) serializing all session attributes to disk, *removing* the attributes, and re-loading them again at the next request and ran into issues of UISessionImpl.attributes beeing empty. I saw UISessionImpl.get/setAttribute is synchronized, is this supposed to be accessed by multiple threads? If so, synchronization has no effect on the app servers synchronization during session replication - it will simply snapshot some inconsistent state). * What could cause the client to immediatly re-execute a new request after receiving a response? Maybe this could be a starting point to debug the request/response storms I am experiencing. Thank you in advance and best regards, Clemens public class BasicEntryPoint extends AbstractEntryPoint { protected void createContents(Composite parent) { Tree tree; ScrolledComposite scroll = new ScrolledComposite(parent, SWT.V_SCROLL); tree = new Tree(scroll, SWT.BORDER); scroll.setContent(tree); scroll.setExpandHorizontal(true); scroll.setExpandVertical(true); tree.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent se) { if(tree.getSelectionCount() > 0) { TreeItem item = tree.getSelection()[0]; item.setText(item.getText() + "_"); }} }); for(int i=0; i < 10; i++) { TreeItem item = new TreeItem(tree, SWT.NONE); item.setText("MainItem " + i); for(int m=0; m < 10; m++) { TreeItem childItem = new TreeItem(item, SWT.NONE); childItem.setText("Child: "+m); } } } } Tomcat cluster configuration: - java.lang.NullPointerException at org.eclipse.rap.rwt.SingletonUtil.getUniqueInstance(SingletonUtil.java:74) at org.eclipse.rap.rwt.internal.lifecycle.RequestCounter.getInstance(RequestCounter.java:25) at org.eclipse.rap.rwt.internal.service.LifeCycleServiceHandler.isRequestCounterValid(LifeCycleServiceHandler.java:133) at org.eclipse.rap.rwt.internal.service.LifeCycleServiceHandler.processUIRequest(LifeCycleServiceHandler.java:94) at org.eclipse.rap.rwt.internal.service.LifeCycleServiceHandler.synchronizedService(LifeCycleServiceHandler.java:75) at org.eclipse.rap.rwt.internal.service.LifeCycleServiceHandler.service(LifeCycleServiceHandler.java:66) at org.eclipse.rap.rwt.engine.RWTServlet.handleValidRequest(RWTServlet.java:135) at org.eclipse.rap.rwt.engine.RWTServlet.handleRequest(RWTServlet.java:117) at org.eclipse.rap.rwt.engine.RWTServlet.doPost(RWTServlet.java:107) java.lang.NullPointerException org.eclipse.swt.graphics.ImageSerializer.getResourceManager(ImageSerializer.java:95) org.eclipse.swt.graphics.ImageSerializer.access$1(ImageSerializer.java:94) org.eclipse.swt.graphics.ImageSerializer$PostDeserializationValidation$1.run(ImageSerializer.java:53)