Stackoverflow error in org.jboss.marshalling.river.RiverUnmarshaller.doReadNewObject
sachindole Jun 7, 2014 3:38 PMHello,
I have configured Infinispan caching for the first time in a standalone local-only wildlfy 8.0 server with the anticipation of rolling it out to a clustered production environment. I have an Async EJB that inserts data into an infinispan cache. It is evident that if more than one thread try to access the cache within the same user transaction (on one web page), then I get a java.lang.StackOverflowError. In the same setup, if I change code to call infinispan get/put methods only once (no matter which thread), then things seem to work fine. Is there a restriction that I flouting? Or is this a bug?
Here is my infinispan config:
<cache-container name="trelairCache" default-cache="trelairCacheDb" module="org.wildfly.clustering.web.infinispan"> <local-cache name="trelairCacheDb" batching="true"> <file-store passivation="false" purge="false"/> </local-cache> </cache-container>
Here are the relevant parts of the exception I get:
[2014-06-07 02:09:10,106] Artifact web:war exploded: Artifact is deployed successfully [2014-06-07 02:09:10,106] Artifact web:war exploded: Deploy took 12,572 milliseconds 14:10:36,427 INFO [org.infinispan.jmx.CacheJmxRegistration] (EJB default - 1) ISPN000031: MBeans were successfully registered to the platform MBean server. 14:10:36,428 INFO [org.jboss.as.clustering.infinispan] (EJB default - 1) JBAS010281: Started trelairCacheDb cache from trelairCache container 14:10:36,570 ERROR [org.infinispan.interceptors.InvocationContextInterceptor] (EJB default - 2) ISPN000136: Execution error: java.lang.StackOverflowError at org.jboss.marshalling.river.RiverUnmarshaller.doReadNewObject(RiverUnmarshaller.java:1273) at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:276) at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:213) at org.jboss.marshalling.river.RiverUnmarshaller.readFields(RiverUnmarshaller.java:1715) at org.jboss.marshalling.river.RiverUnmarshaller.doInitSerializable(RiverUnmarshaller.java:1631) at org.jboss.marshalling.river.RiverUnmarshaller.doInitSerializable(RiverUnmarshaller.java:1595) at org.jboss.marshalling.river.RiverUnmarshaller.doInitSerializable(RiverUnmarshaller.java:1595) at org.jboss.marshalling.river.RiverUnmarshaller.doInitSerializable(RiverUnmarshaller.java:1595) at org.jboss.marshalling.river.RiverUnmarshaller.doReadNewObject(RiverUnmarshaller.java:1273) at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:276) at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:213) at org.jboss.marshalling.river.RiverUnmarshaller.readFields(RiverUnmarshaller.java:1715) at org.jboss.marshalling.river.RiverUnmarshaller.doInitSerializable(RiverUnmarshaller.java:1631) at org.jboss.marshalling.river.RiverUnmarshaller.doInitSerializable(RiverUnmarshaller.java:1595) at org.jboss.marshalling.river.RiverUnmarshaller.doInitSerializable(RiverUnmarshaller.java:1595) at org.jboss.marshalling.river.RiverUnmarshaller.doInitSerializable(RiverUnmarshaller.java:1595) at org.jboss.marshalling.river.RiverUnmarshaller.doReadNewObject(RiverUnmarshaller.java:1273) at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:276) at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:213) at org.jboss.marshalling.river.RiverUnmarshaller.readFields(RiverUnmarshaller.java:1715) at org.jboss.marshalling.river.RiverUnmarshaller.doInitSerializable(RiverUnmarshaller.java:1631) at org.jboss.marshalling.river.RiverUnmarshaller.doInitSerializable(RiverUnmarshaller.java:1595) at org.jboss.marshalling.river.RiverUnmarshaller.doInitSerializable(RiverUnmarshaller.java:1595) at org.jboss.marshalling.river.RiverUnmarshaller.doInitSerializable(RiverUnmarshaller.java:1595) at org.jboss.marshalling.river.RiverUnmarshaller.doReadNewObject(RiverUnmarshaller.java:1273) at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:276) at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:213) at org.jboss.marshalling.river.RiverUnmarshaller.readFields(RiverUnmarshaller.java:1715) at org.jboss.marshalling.river.RiverUnmarshaller.doInitSerializable(RiverUnmarshaller.java:1631)
14:10:36,620 ERROR [org.jboss.as.ejb3] (EJB default - 2) javax.ejb.EJBTransactionRolledbackException: java.lang.StackOverflowError 14:10:36,621 ERROR [org.jboss.as.ejb3.invocation] (EJB default - 2) JBAS014134: EJB Invocation failed on component mqPlaceService for method public abstract java.util.List com.trelair.external.services.translation.mq.PlaceService.findOsmRestaurants(com.vividsolutions.jts.geom.Point): javax.ejb.EJBTransactionRolledbackException: java.lang.StackOverflowError at org.jboss.as.ejb3.tx.CMTTxInterceptor.handleInCallerTx(CMTTxInterceptor.java:163) [wildfly-ejb3-8.0.0.Final.jar:8.0.0.Final] at org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInCallerTx(CMTTxInterceptor.java:253) [wildfly-ejb3-8.0.0.Final.jar:8.0.0.Final] at org.jboss.as.ejb3.tx.CMTTxInterceptor.required(CMTTxInterceptor.java:342) [wildfly-ejb3-8.0.0.Final.jar:8.0.0.Final] at org.jboss.as.ejb3.tx.CMTTxInterceptor.processInvocation(CMTTxInterceptor.java:239) [wildfly-ejb3-8.0.0.Final
at org.jboss.threads.JBossThread.run(JBossThread.java:122) Caused by: org.infinispan.commons.CacheException: java.lang.StackOverflowError at org.infinispan.interceptors.InterceptorChain.invoke(InterceptorChain.java:341) [infinispan-core-6.0.1.Final.jar:6.0.1.Final] at org.infinispan.CacheImpl.get(CacheImpl.java:377) [infinispan-core-6.0.1.Final.jar:6.0.1.Final] at org.infinispan.CacheImpl.get(CacheImpl.java:369) [infinispan-core-6.0.1.Final.jar:6.0.1.Final] at org.infinispan.AbstractDelegatingCache.get(AbstractDelegatingCache.java:271) [infinispan-core-6.0.1.Final.jar:6.0.1.Final] at com.trelair.external.endpoints.mapquest.TrelairCache.get(TrelairCache.java:24) [classes:]
And finally, here are two classes that I wrote to access the cache:
public class TrelairCache<K, V> { @Resource(lookup = "java:jboss/infinispan/container/trelairCache") private org.infinispan.manager.CacheContainer container; private org.infinispan.Cache<K, V> cache; @PostConstruct public void start() { this.cache = this.container.getCache(); } public void put(K key, V value) { this.cache.put(key, value); } public V get(K key) { return this.cache.get(key); } }
@ManagedBean public class MqCache extends TrelairCache<URL,Document> { }