2

We have a GWT application deployed onto tomcat, after a few hours of use (2 QAs perform general testing), java process start to use all CPUs and app become slow.

I looked into tomcat manager and find out there are many long running HTTP requests and they are all pointing to "/gwtRequest" which is our RequestFactory servlet.

After that I took a thread dump and found out that all RUNNABLE http threads in the dump are pointing to "AutoBeanCodexImpl.doCoderFor()"

"http-8080-51" daemon prio=10 tid=0x00007f23d8b81800 nid=0x4981 runnable [0x00007f23d4285000]
java.lang.Thread.State: RUNNABLE
at java.util.HashMap.get(HashMap.java:303)
at com.google.web.bindery.autobean.shared.impl.AutoBeanCodexImpl.doCoderFor(AutoBeanCodexImpl.java:519)
at com.google.web.bindery.autobean.shared.impl.AbstractAutoBean.setProperty(AbstractAutoBean.java:276)
at com.google.web.bindery.autobean.vm.impl.ProxyAutoBean.setProperty(ProxyAutoBean.java:253)
at com.google.web.bindery.autobean.vm.impl.BeanPropertyContext.set(BeanPropertyContext.java:44)
at com.google.web.bindery.requestfactory.server.Resolver$PropertyResolver.visitValueProperty(Resolver.java:155)
at com.google.web.bindery.autobean.vm.impl.ProxyAutoBean.traverseProperties(ProxyAutoBean.java:289)
at com.google.web.bindery.autobean.shared.impl.AbstractAutoBean.traverse(AbstractAutoBean.java:166)
at com.google.web.bindery.autobean.shared.impl.AbstractAutoBean.accept(AbstractAutoBean.java:101)
at com.google.web.bindery.requestfactory.server.Resolver.resolveClientValue(Resolver.java:414)
at com.google.web.bindery.requestfactory.server.SimpleRequestProcessor.processInvocationMessages(SimpleRequestProcessor.java:493)
at com.google.web.bindery.requestfactory.server.SimpleRequestProcessor.process(SimpleRequestProcessor.java:235)
at com.google.web.bindery.requestfactory.server.SimpleRequestProcessor.process(SimpleRequestProcessor.java:137)
at com.google.web.bindery.requestfactory.server.RequestFactoryServlet.doPost(RequestFactoryServlet.java:133)

Can someone kindly point me to areas I should look at? Thanks

Jiang Zhu
  • 97
  • 1
  • 8

1 Answers1

2

Ah, ouch! It looks like we're using a static HashMap without any synchronization! I believe this is because AutoBeans were first designed to work in the browser only, which is single-threaded.

This is fixed in trunk and it should make it into 2.5.0-rc2 to be released in a few days. You can track the issue status.

Thomas Broyer
  • 64,353
  • 7
  • 91
  • 164
  • May I ask a silly question, if it is synchronization issue, should it cause deadlock, can it also cause endless loop in some circumstances? – Jiang Zhu Sep 14 '12 at 01:37
  • found answer to my question in http://stackoverflow.com/questions/1003026/hashmap-concurrency-issue – Jiang Zhu Sep 14 '12 at 01:43