[JBoss JIRA] (ISPN-9300) ReplicationQueue ISPN000072: Failed replicating XXX elements in replication queue org.infinispan.commons.CacheException: java.lang.RuntimeException: Failure to marshal argument(s
by Nilesh Deshpande (JIRA)
[ https://issues.jboss.org/browse/ISPN-9300?page=com.atlassian.jira.plugin.... ]
Nilesh Deshpande commented on ISPN-9300:
----------------------------------------
Is there work around I can use for it in 7.2.4?
> ReplicationQueue ISPN000072: Failed replicating XXX elements in replication queue org.infinispan.commons.CacheException: java.lang.RuntimeException: Failure to marshal argument(s
> ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
> Key: ISPN-9300
> URL: https://issues.jboss.org/browse/ISPN-9300
> Project: Infinispan
> Issue Type: Bug
> Components: Core
> Affects Versions: 7.2.4.Final
> Reporter: Nilesh Deshpande
>
> *I am getting continuous error in the log for following.*
> ERROR 06/16 21:38:03.910 [replicationQueue-thread--p4-t1] o.i.r.ReplicationQueue ISPN000072: Failed replicating 114 elements in replication queue
> org.infinispan.commons.CacheException: java.lang.RuntimeException: Failure to marshal argument(s)
> at org.infinispan.commons.util.Util.rewrapAsCacheException(Util.java:657)
> at org.infinispan.remoting.transport.jgroups.CommandAwareRpcDispatcher.invokeRemoteCommand(CommandAwareRpcDispatcher.java:250)
> at org.infinispan.remoting.transport.jgroups.JGroupsTransport.invokeRemotely(JGroupsTransport.java:561)
> at org.infinispan.remoting.rpc.RpcManagerImpl.invokeRemotely(RpcManagerImpl.java:287)
> at org.infinispan.remoting.ReplicationQueueImpl.flush(ReplicationQueueImpl.java:152)
> at org.infinispan.remoting.ReplicationQueueImpl$1.run(ReplicationQueueImpl.java:103)
> at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
> at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
> at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
> at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
> at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
> at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
> at java.lang.Thread.run(Thread.java:748)
> Caused by: java.lang.RuntimeException: Failure to marshal argument(s)
> at org.infinispan.remoting.transport.jgroups.CommandAwareRpcDispatcher.marshallCall(CommandAwareRpcDispatcher.java:417)
> at org.infinispan.remoting.transport.jgroups.CommandAwareRpcDispatcher.processSingleCall(CommandAwareRpcDispatcher.java:432)
> at org.infinispan.remoting.transport.jgroups.CommandAwareRpcDispatcher.invokeRemoteCommand(CommandAwareRpcDispatcher.java:241)
> ... 11 common frames omitted
> Caused by: java.util.ConcurrentModificationException: null
> at java.util.HashMap$HashIterator.nextNode(HashMap.java:1442)
> at java.util.HashMap$KeyIterator.next(HashMap.java:1466)
> at org.infinispan.commons.marshall.MarshallUtil.marshallCollection(MarshallUtil.java:24)
> at org.infinispan.marshall.exts.SetExternalizer.writeObject(SetExternalizer.java:44)
> at org.infinispan.marshall.exts.SetExternalizer.writeObject(SetExternalizer.java:26)
> at org.infinispan.marshall.core.ExternalizerTable$ExternalizerAdapter.writeObject(ExternalizerTable.java:442)
> at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:144)
> at org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1062)
> at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1018)
> at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:884)
> at org.jboss.marshalling.AbstractObjectOutput.writeObject(AbstractObjectOutput.java:58)
> at org.jboss.marshalling.AbstractMarshaller.writeObject(AbstractMarshaller.java:111)
> at org.infinispan.marshall.exts.ReplicableCommandExternalizer.writeCommandParameters(ReplicableCommandExternalizer.java:58)
> at org.infinispan.marshall.exts.ReplicableCommandExternalizer.writeObject(ReplicableCommandExternalizer.java:43)
> at org.infinispan.marshall.exts.ReplicableCommandExternalizer.writeObject(ReplicableCommandExternalizer.java:31)
> at org.infinispan.marshall.core.ExternalizerTable$ExternalizerAdapter.writeObject(ExternalizerTable.java:442)
> at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:144)
> at org.jboss.marshalling.AbstractObjectOutput.writeObject(AbstractObjectOutput.java:58)
> at org.jboss.marshalling.AbstractMarshaller.writeObject(AbstractMarshaller.java:111)
> at org.infinispan.marshall.exts.ReplicableCommandExternalizer.writeCommandParameters(ReplicableCommandExternalizer.java:58)
> at org.infinispan.marshall.exts.CacheRpcCommandExternalizer.marshallParameters(CacheRpcCommandExternalizer.java:124)
> at org.infinispan.marshall.exts.CacheRpcCommandExternalizer.writeObject(CacheRpcCommandExternalizer.java:108)
> at org.infinispan.marshall.exts.CacheRpcCommandExternalizer.writeObject(CacheRpcCommandExternalizer.java:65)
> at org.infinispan.marshall.core.ExternalizerTable$ExternalizerAdapter.writeObject(ExternalizerTable.java:442)
> at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:144)
> at org.jboss.marshalling.AbstractObjectOutput.writeObject(AbstractObjectOutput.java:58)
> at org.jboss.marshalling.AbstractMarshaller.writeObject(AbstractMarshaller.java:111)
> at org.infinispan.marshall.exts.ReplicableCommandExternalizer.writeCommandParameters(ReplicableCommandExternalizer.java:58)
> at org.infinispan.marshall.exts.CacheRpcCommandExternalizer.marshallParameters(CacheRpcCommandExternalizer.java:124)
> at org.infinispan.marshall.exts.CacheRpcCommandExternalizer.writeObject(CacheRpcCommandExternalizer.java:108)
> at org.infinispan.marshall.exts.CacheRpcCommandExternalizer.writeObject(CacheRpcCommandExternalizer.java:65)
> at org.infinispan.marshall.core.ExternalizerTable$ExternalizerAdapter.writeObject(ExternalizerTable.java:442)
> at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:144)
> at org.jboss.marshalling.AbstractObjectOutput.writeObject(AbstractObjectOutput.java:58)
> at org.jboss.marshalling.AbstractMarshaller.writeObject(AbstractMarshaller.java:111)
> at org.infinispan.commons.marshall.jboss.AbstractJBossMarshaller.objectToObjectStream(AbstractJBossMarshaller.java:72)
> at org.infinispan.marshall.core.VersionAwareMarshaller.objectToBuffer(VersionAwareMarshaller.java:77)
> at org.infinispan.commons.marshall.AbstractMarshaller.objectToBuffer(AbstractMarshaller.java:41)
> at org.infinispan.commons.marshall.AbstractDelegatingMarshaller.objectToBuffer(AbstractDelegatingMarshaller.java:85)
> at org.infinispan.remoting.transport.jgroups.MarshallerAdapter.objectToBuffer(MarshallerAdapter.java:23)
> at org.infinispan.remoting.transport.jgroups.CommandAwareRpcDispatcher.marshallCall(CommandAwareRpcDispatcher.java:415)
> ... 13 common frames omitted
> Caused by: org.jboss.marshalling.TraceInformation: null
> *My cache setting is following*
> <?xml version="1.0" encoding="UTF-8"?>
> <infinispan
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:schemaLocation="urn:infinispan:config:7.0 http://www.infinispan.org/schemas/infinispan-config-7.0.xsd"
> xmlns="urn:infinispan:config:7.0">
> <jgroups>
> <stack-file name="configurationFile" path="cache-replicator.conf"/>
> </jgroups>
> <cache-container default-cache="defaultCache">
> <!--
> Enables collection of global JMX statistics, and allows you to customize the JMX domain name under which
> MBeans are registered.
> -->
>
> <jmx>
> <property name="enabled">false</property>
> <property name="jmxDomain">org.infinispan</property>
> <property name="cacheManagerName">CacheManager</property>
> <property name="statistics">false</property>
> </jmx>
>
>
> <!--
> If the transport is omitted, there is no way to create distributed or clustered caches.
> There is no added cost to defining a transport and not creating a cache that uses one, since the transport
> is created and initialized lazily. By default, the JGroupsTransport is used.
> Note that the JGroups transport uses sensible defaults if no configuration property is defined.
> See:
> http://community.jboss.org/wiki/ClusteredConfigurationQuickStart
> http://docs.jboss.org/infinispan/5.0/apidocs/org/infinispan/remoting/tran...
> -->
>
>
>
>
> <transport cluster="TrueSight-Cache-cluster" stack="configurationFile">
> </transport>
> <!--
> Used to register JVM shutdown hooks.
> hookBehavior: DEFAULT, REGISTER, DONT_REGISTER
> -->
> <!-- <shutdown hookBehavior="DONT_REGISTER"/> -->
>
> <local-cache name="defaultCache" statistics="false">
> <!-- <storeAsBinary /> -->
> <!--
> Tunes the locking and concurrency characteristics of the cache.
> See:
> http://community.jboss.org/wiki/LockingandConcurrency
> -->
> <locking
> isolation="READ_COMMITTED"
> acquire-timeout="20000"
> write-skew="false"
> concurrency-level="5000"
> striping="false"
> />
> <!--
> Used to register JMX statistics in any available MBean server
>
> <jmxStatistics enabled="false"/>-->
> <!--
> Used to control whether objects stored in Infinispan nodes are primarily stored as rehydrated Objects or as
> raw byte arrays. See:
> http://community.jboss.org/wiki/Marshalling#Lazy_Deserialization
> -->
> <!-- <storeAsBinary enabled="true"/> -->
> <!--
> Used to enable invocation batching and allow the use of Cache.startBatch()/endBatch() methods.
> http://community.jboss.org/wiki/Batching
>
> <invocationBatching enabled="true"/> -->
>
> <transaction mode="BATCH"/>
> <!--
> This element specifies that the cache is clustered.
> modes supported: distribution (d), replication (r) or invalidation (i).
> http://community.jboss.org/wiki/Clusteringmodes
> -->
>
>
> </local-cache>
> <replicated-cache name="defaultCache" mode="ASYNC" queue-size="500" queue-flush-interval="10000">
>
> <state-transfer await-initial-transfer="false"
> timeout="240000"
> enabled="true"
> chunk-size="10000"
> />
> <!--Default write-skew is false, concurrency-level is 16 and acquire-timeout is 20 seconds in infinispan. Increasing -->
> <locking concurrency-level="1000" striping="true" acquire-timeout="240000"
> isolation="READ_COMMITTED" write-skew="false"/>
> <!-- <sync replTimeout="20000"/> -->
> <!-- async replication. -->
>
> </replicated-cache>
> </cache-container>
> </infinispan>
--
This message was sent by Atlassian JIRA
(v7.5.0#75005)
6 years, 6 months
[JBoss JIRA] (ISPN-9300) ReplicationQueue ISPN000072: Failed replicating XXX elements in replication queue org.infinispan.commons.CacheException: java.lang.RuntimeException: Failure to marshal argument(s
by Tristan Tarrant (JIRA)
[ https://issues.jboss.org/browse/ISPN-9300?page=com.atlassian.jira.plugin.... ]
Tristan Tarrant closed ISPN-9300.
---------------------------------
Resolution: Won't Fix
The replication queue was removed in Infinispan 8. You should however upgrade to the latest release (9.2.x at the time of writing).
> ReplicationQueue ISPN000072: Failed replicating XXX elements in replication queue org.infinispan.commons.CacheException: java.lang.RuntimeException: Failure to marshal argument(s
> ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
> Key: ISPN-9300
> URL: https://issues.jboss.org/browse/ISPN-9300
> Project: Infinispan
> Issue Type: Bug
> Components: Core
> Affects Versions: 7.2.4.Final
> Reporter: Nilesh Deshpande
>
> *I am getting continuous error in the log for following.*
> ERROR 06/16 21:38:03.910 [replicationQueue-thread--p4-t1] o.i.r.ReplicationQueue ISPN000072: Failed replicating 114 elements in replication queue
> org.infinispan.commons.CacheException: java.lang.RuntimeException: Failure to marshal argument(s)
> at org.infinispan.commons.util.Util.rewrapAsCacheException(Util.java:657)
> at org.infinispan.remoting.transport.jgroups.CommandAwareRpcDispatcher.invokeRemoteCommand(CommandAwareRpcDispatcher.java:250)
> at org.infinispan.remoting.transport.jgroups.JGroupsTransport.invokeRemotely(JGroupsTransport.java:561)
> at org.infinispan.remoting.rpc.RpcManagerImpl.invokeRemotely(RpcManagerImpl.java:287)
> at org.infinispan.remoting.ReplicationQueueImpl.flush(ReplicationQueueImpl.java:152)
> at org.infinispan.remoting.ReplicationQueueImpl$1.run(ReplicationQueueImpl.java:103)
> at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
> at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
> at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
> at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
> at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
> at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
> at java.lang.Thread.run(Thread.java:748)
> Caused by: java.lang.RuntimeException: Failure to marshal argument(s)
> at org.infinispan.remoting.transport.jgroups.CommandAwareRpcDispatcher.marshallCall(CommandAwareRpcDispatcher.java:417)
> at org.infinispan.remoting.transport.jgroups.CommandAwareRpcDispatcher.processSingleCall(CommandAwareRpcDispatcher.java:432)
> at org.infinispan.remoting.transport.jgroups.CommandAwareRpcDispatcher.invokeRemoteCommand(CommandAwareRpcDispatcher.java:241)
> ... 11 common frames omitted
> Caused by: java.util.ConcurrentModificationException: null
> at java.util.HashMap$HashIterator.nextNode(HashMap.java:1442)
> at java.util.HashMap$KeyIterator.next(HashMap.java:1466)
> at org.infinispan.commons.marshall.MarshallUtil.marshallCollection(MarshallUtil.java:24)
> at org.infinispan.marshall.exts.SetExternalizer.writeObject(SetExternalizer.java:44)
> at org.infinispan.marshall.exts.SetExternalizer.writeObject(SetExternalizer.java:26)
> at org.infinispan.marshall.core.ExternalizerTable$ExternalizerAdapter.writeObject(ExternalizerTable.java:442)
> at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:144)
> at org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1062)
> at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1018)
> at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:884)
> at org.jboss.marshalling.AbstractObjectOutput.writeObject(AbstractObjectOutput.java:58)
> at org.jboss.marshalling.AbstractMarshaller.writeObject(AbstractMarshaller.java:111)
> at org.infinispan.marshall.exts.ReplicableCommandExternalizer.writeCommandParameters(ReplicableCommandExternalizer.java:58)
> at org.infinispan.marshall.exts.ReplicableCommandExternalizer.writeObject(ReplicableCommandExternalizer.java:43)
> at org.infinispan.marshall.exts.ReplicableCommandExternalizer.writeObject(ReplicableCommandExternalizer.java:31)
> at org.infinispan.marshall.core.ExternalizerTable$ExternalizerAdapter.writeObject(ExternalizerTable.java:442)
> at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:144)
> at org.jboss.marshalling.AbstractObjectOutput.writeObject(AbstractObjectOutput.java:58)
> at org.jboss.marshalling.AbstractMarshaller.writeObject(AbstractMarshaller.java:111)
> at org.infinispan.marshall.exts.ReplicableCommandExternalizer.writeCommandParameters(ReplicableCommandExternalizer.java:58)
> at org.infinispan.marshall.exts.CacheRpcCommandExternalizer.marshallParameters(CacheRpcCommandExternalizer.java:124)
> at org.infinispan.marshall.exts.CacheRpcCommandExternalizer.writeObject(CacheRpcCommandExternalizer.java:108)
> at org.infinispan.marshall.exts.CacheRpcCommandExternalizer.writeObject(CacheRpcCommandExternalizer.java:65)
> at org.infinispan.marshall.core.ExternalizerTable$ExternalizerAdapter.writeObject(ExternalizerTable.java:442)
> at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:144)
> at org.jboss.marshalling.AbstractObjectOutput.writeObject(AbstractObjectOutput.java:58)
> at org.jboss.marshalling.AbstractMarshaller.writeObject(AbstractMarshaller.java:111)
> at org.infinispan.marshall.exts.ReplicableCommandExternalizer.writeCommandParameters(ReplicableCommandExternalizer.java:58)
> at org.infinispan.marshall.exts.CacheRpcCommandExternalizer.marshallParameters(CacheRpcCommandExternalizer.java:124)
> at org.infinispan.marshall.exts.CacheRpcCommandExternalizer.writeObject(CacheRpcCommandExternalizer.java:108)
> at org.infinispan.marshall.exts.CacheRpcCommandExternalizer.writeObject(CacheRpcCommandExternalizer.java:65)
> at org.infinispan.marshall.core.ExternalizerTable$ExternalizerAdapter.writeObject(ExternalizerTable.java:442)
> at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:144)
> at org.jboss.marshalling.AbstractObjectOutput.writeObject(AbstractObjectOutput.java:58)
> at org.jboss.marshalling.AbstractMarshaller.writeObject(AbstractMarshaller.java:111)
> at org.infinispan.commons.marshall.jboss.AbstractJBossMarshaller.objectToObjectStream(AbstractJBossMarshaller.java:72)
> at org.infinispan.marshall.core.VersionAwareMarshaller.objectToBuffer(VersionAwareMarshaller.java:77)
> at org.infinispan.commons.marshall.AbstractMarshaller.objectToBuffer(AbstractMarshaller.java:41)
> at org.infinispan.commons.marshall.AbstractDelegatingMarshaller.objectToBuffer(AbstractDelegatingMarshaller.java:85)
> at org.infinispan.remoting.transport.jgroups.MarshallerAdapter.objectToBuffer(MarshallerAdapter.java:23)
> at org.infinispan.remoting.transport.jgroups.CommandAwareRpcDispatcher.marshallCall(CommandAwareRpcDispatcher.java:415)
> ... 13 common frames omitted
> Caused by: org.jboss.marshalling.TraceInformation: null
> *My cache setting is following*
> <?xml version="1.0" encoding="UTF-8"?>
> <infinispan
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:schemaLocation="urn:infinispan:config:7.0 http://www.infinispan.org/schemas/infinispan-config-7.0.xsd"
> xmlns="urn:infinispan:config:7.0">
> <jgroups>
> <stack-file name="configurationFile" path="cache-replicator.conf"/>
> </jgroups>
> <cache-container default-cache="defaultCache">
> <!--
> Enables collection of global JMX statistics, and allows you to customize the JMX domain name under which
> MBeans are registered.
> -->
>
> <jmx>
> <property name="enabled">false</property>
> <property name="jmxDomain">org.infinispan</property>
> <property name="cacheManagerName">CacheManager</property>
> <property name="statistics">false</property>
> </jmx>
>
>
> <!--
> If the transport is omitted, there is no way to create distributed or clustered caches.
> There is no added cost to defining a transport and not creating a cache that uses one, since the transport
> is created and initialized lazily. By default, the JGroupsTransport is used.
> Note that the JGroups transport uses sensible defaults if no configuration property is defined.
> See:
> http://community.jboss.org/wiki/ClusteredConfigurationQuickStart
> http://docs.jboss.org/infinispan/5.0/apidocs/org/infinispan/remoting/tran...
> -->
>
>
>
>
> <transport cluster="TrueSight-Cache-cluster" stack="configurationFile">
> </transport>
> <!--
> Used to register JVM shutdown hooks.
> hookBehavior: DEFAULT, REGISTER, DONT_REGISTER
> -->
> <!-- <shutdown hookBehavior="DONT_REGISTER"/> -->
>
> <local-cache name="defaultCache" statistics="false">
> <!-- <storeAsBinary /> -->
> <!--
> Tunes the locking and concurrency characteristics of the cache.
> See:
> http://community.jboss.org/wiki/LockingandConcurrency
> -->
> <locking
> isolation="READ_COMMITTED"
> acquire-timeout="20000"
> write-skew="false"
> concurrency-level="5000"
> striping="false"
> />
> <!--
> Used to register JMX statistics in any available MBean server
>
> <jmxStatistics enabled="false"/>-->
> <!--
> Used to control whether objects stored in Infinispan nodes are primarily stored as rehydrated Objects or as
> raw byte arrays. See:
> http://community.jboss.org/wiki/Marshalling#Lazy_Deserialization
> -->
> <!-- <storeAsBinary enabled="true"/> -->
> <!--
> Used to enable invocation batching and allow the use of Cache.startBatch()/endBatch() methods.
> http://community.jboss.org/wiki/Batching
>
> <invocationBatching enabled="true"/> -->
>
> <transaction mode="BATCH"/>
> <!--
> This element specifies that the cache is clustered.
> modes supported: distribution (d), replication (r) or invalidation (i).
> http://community.jboss.org/wiki/Clusteringmodes
> -->
>
>
> </local-cache>
> <replicated-cache name="defaultCache" mode="ASYNC" queue-size="500" queue-flush-interval="10000">
>
> <state-transfer await-initial-transfer="false"
> timeout="240000"
> enabled="true"
> chunk-size="10000"
> />
> <!--Default write-skew is false, concurrency-level is 16 and acquire-timeout is 20 seconds in infinispan. Increasing -->
> <locking concurrency-level="1000" striping="true" acquire-timeout="240000"
> isolation="READ_COMMITTED" write-skew="false"/>
> <!-- <sync replTimeout="20000"/> -->
> <!-- async replication. -->
>
> </replicated-cache>
> </cache-container>
> </infinispan>
--
This message was sent by Atlassian JIRA
(v7.5.0#75005)
6 years, 6 months
[JBoss JIRA] (ISPN-9300) ReplicationQueue ISPN000072: Failed replicating XXX elements in replication queue org.infinispan.commons.CacheException: java.lang.RuntimeException: Failure to marshal argument(s
by Nilesh Deshpande (JIRA)
[ https://issues.jboss.org/browse/ISPN-9300?page=com.atlassian.jira.plugin.... ]
Nilesh Deshpande updated ISPN-9300:
-----------------------------------
Affects Version/s: 7.2.4.Final
(was: 7.2.2.Final)
> ReplicationQueue ISPN000072: Failed replicating XXX elements in replication queue org.infinispan.commons.CacheException: java.lang.RuntimeException: Failure to marshal argument(s
> ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
> Key: ISPN-9300
> URL: https://issues.jboss.org/browse/ISPN-9300
> Project: Infinispan
> Issue Type: Bug
> Components: Core
> Affects Versions: 7.2.4.Final
> Reporter: Nilesh Deshpande
>
> *I am getting continuous error in the log for following.*
> ERROR 06/16 21:38:03.910 [replicationQueue-thread--p4-t1] o.i.r.ReplicationQueue ISPN000072: Failed replicating 114 elements in replication queue
> org.infinispan.commons.CacheException: java.lang.RuntimeException: Failure to marshal argument(s)
> at org.infinispan.commons.util.Util.rewrapAsCacheException(Util.java:657)
> at org.infinispan.remoting.transport.jgroups.CommandAwareRpcDispatcher.invokeRemoteCommand(CommandAwareRpcDispatcher.java:250)
> at org.infinispan.remoting.transport.jgroups.JGroupsTransport.invokeRemotely(JGroupsTransport.java:561)
> at org.infinispan.remoting.rpc.RpcManagerImpl.invokeRemotely(RpcManagerImpl.java:287)
> at org.infinispan.remoting.ReplicationQueueImpl.flush(ReplicationQueueImpl.java:152)
> at org.infinispan.remoting.ReplicationQueueImpl$1.run(ReplicationQueueImpl.java:103)
> at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
> at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
> at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
> at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
> at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
> at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
> at java.lang.Thread.run(Thread.java:748)
> Caused by: java.lang.RuntimeException: Failure to marshal argument(s)
> at org.infinispan.remoting.transport.jgroups.CommandAwareRpcDispatcher.marshallCall(CommandAwareRpcDispatcher.java:417)
> at org.infinispan.remoting.transport.jgroups.CommandAwareRpcDispatcher.processSingleCall(CommandAwareRpcDispatcher.java:432)
> at org.infinispan.remoting.transport.jgroups.CommandAwareRpcDispatcher.invokeRemoteCommand(CommandAwareRpcDispatcher.java:241)
> ... 11 common frames omitted
> Caused by: java.util.ConcurrentModificationException: null
> at java.util.HashMap$HashIterator.nextNode(HashMap.java:1442)
> at java.util.HashMap$KeyIterator.next(HashMap.java:1466)
> at org.infinispan.commons.marshall.MarshallUtil.marshallCollection(MarshallUtil.java:24)
> at org.infinispan.marshall.exts.SetExternalizer.writeObject(SetExternalizer.java:44)
> at org.infinispan.marshall.exts.SetExternalizer.writeObject(SetExternalizer.java:26)
> at org.infinispan.marshall.core.ExternalizerTable$ExternalizerAdapter.writeObject(ExternalizerTable.java:442)
> at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:144)
> at org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1062)
> at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1018)
> at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:884)
> at org.jboss.marshalling.AbstractObjectOutput.writeObject(AbstractObjectOutput.java:58)
> at org.jboss.marshalling.AbstractMarshaller.writeObject(AbstractMarshaller.java:111)
> at org.infinispan.marshall.exts.ReplicableCommandExternalizer.writeCommandParameters(ReplicableCommandExternalizer.java:58)
> at org.infinispan.marshall.exts.ReplicableCommandExternalizer.writeObject(ReplicableCommandExternalizer.java:43)
> at org.infinispan.marshall.exts.ReplicableCommandExternalizer.writeObject(ReplicableCommandExternalizer.java:31)
> at org.infinispan.marshall.core.ExternalizerTable$ExternalizerAdapter.writeObject(ExternalizerTable.java:442)
> at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:144)
> at org.jboss.marshalling.AbstractObjectOutput.writeObject(AbstractObjectOutput.java:58)
> at org.jboss.marshalling.AbstractMarshaller.writeObject(AbstractMarshaller.java:111)
> at org.infinispan.marshall.exts.ReplicableCommandExternalizer.writeCommandParameters(ReplicableCommandExternalizer.java:58)
> at org.infinispan.marshall.exts.CacheRpcCommandExternalizer.marshallParameters(CacheRpcCommandExternalizer.java:124)
> at org.infinispan.marshall.exts.CacheRpcCommandExternalizer.writeObject(CacheRpcCommandExternalizer.java:108)
> at org.infinispan.marshall.exts.CacheRpcCommandExternalizer.writeObject(CacheRpcCommandExternalizer.java:65)
> at org.infinispan.marshall.core.ExternalizerTable$ExternalizerAdapter.writeObject(ExternalizerTable.java:442)
> at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:144)
> at org.jboss.marshalling.AbstractObjectOutput.writeObject(AbstractObjectOutput.java:58)
> at org.jboss.marshalling.AbstractMarshaller.writeObject(AbstractMarshaller.java:111)
> at org.infinispan.marshall.exts.ReplicableCommandExternalizer.writeCommandParameters(ReplicableCommandExternalizer.java:58)
> at org.infinispan.marshall.exts.CacheRpcCommandExternalizer.marshallParameters(CacheRpcCommandExternalizer.java:124)
> at org.infinispan.marshall.exts.CacheRpcCommandExternalizer.writeObject(CacheRpcCommandExternalizer.java:108)
> at org.infinispan.marshall.exts.CacheRpcCommandExternalizer.writeObject(CacheRpcCommandExternalizer.java:65)
> at org.infinispan.marshall.core.ExternalizerTable$ExternalizerAdapter.writeObject(ExternalizerTable.java:442)
> at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:144)
> at org.jboss.marshalling.AbstractObjectOutput.writeObject(AbstractObjectOutput.java:58)
> at org.jboss.marshalling.AbstractMarshaller.writeObject(AbstractMarshaller.java:111)
> at org.infinispan.commons.marshall.jboss.AbstractJBossMarshaller.objectToObjectStream(AbstractJBossMarshaller.java:72)
> at org.infinispan.marshall.core.VersionAwareMarshaller.objectToBuffer(VersionAwareMarshaller.java:77)
> at org.infinispan.commons.marshall.AbstractMarshaller.objectToBuffer(AbstractMarshaller.java:41)
> at org.infinispan.commons.marshall.AbstractDelegatingMarshaller.objectToBuffer(AbstractDelegatingMarshaller.java:85)
> at org.infinispan.remoting.transport.jgroups.MarshallerAdapter.objectToBuffer(MarshallerAdapter.java:23)
> at org.infinispan.remoting.transport.jgroups.CommandAwareRpcDispatcher.marshallCall(CommandAwareRpcDispatcher.java:415)
> ... 13 common frames omitted
> Caused by: org.jboss.marshalling.TraceInformation: null
> *My cache setting is following*
> <?xml version="1.0" encoding="UTF-8"?>
> <infinispan
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:schemaLocation="urn:infinispan:config:7.0 http://www.infinispan.org/schemas/infinispan-config-7.0.xsd"
> xmlns="urn:infinispan:config:7.0">
> <jgroups>
> <stack-file name="configurationFile" path="cache-replicator.conf"/>
> </jgroups>
> <cache-container default-cache="defaultCache">
> <!--
> Enables collection of global JMX statistics, and allows you to customize the JMX domain name under which
> MBeans are registered.
> -->
>
> <jmx>
> <property name="enabled">false</property>
> <property name="jmxDomain">org.infinispan</property>
> <property name="cacheManagerName">CacheManager</property>
> <property name="statistics">false</property>
> </jmx>
>
>
> <!--
> If the transport is omitted, there is no way to create distributed or clustered caches.
> There is no added cost to defining a transport and not creating a cache that uses one, since the transport
> is created and initialized lazily. By default, the JGroupsTransport is used.
> Note that the JGroups transport uses sensible defaults if no configuration property is defined.
> See:
> http://community.jboss.org/wiki/ClusteredConfigurationQuickStart
> http://docs.jboss.org/infinispan/5.0/apidocs/org/infinispan/remoting/tran...
> -->
>
>
>
>
> <transport cluster="TrueSight-Cache-cluster" stack="configurationFile">
> </transport>
> <!--
> Used to register JVM shutdown hooks.
> hookBehavior: DEFAULT, REGISTER, DONT_REGISTER
> -->
> <!-- <shutdown hookBehavior="DONT_REGISTER"/> -->
>
> <local-cache name="defaultCache" statistics="false">
> <!-- <storeAsBinary /> -->
> <!--
> Tunes the locking and concurrency characteristics of the cache.
> See:
> http://community.jboss.org/wiki/LockingandConcurrency
> -->
> <locking
> isolation="READ_COMMITTED"
> acquire-timeout="20000"
> write-skew="false"
> concurrency-level="5000"
> striping="false"
> />
> <!--
> Used to register JMX statistics in any available MBean server
>
> <jmxStatistics enabled="false"/>-->
> <!--
> Used to control whether objects stored in Infinispan nodes are primarily stored as rehydrated Objects or as
> raw byte arrays. See:
> http://community.jboss.org/wiki/Marshalling#Lazy_Deserialization
> -->
> <!-- <storeAsBinary enabled="true"/> -->
> <!--
> Used to enable invocation batching and allow the use of Cache.startBatch()/endBatch() methods.
> http://community.jboss.org/wiki/Batching
>
> <invocationBatching enabled="true"/> -->
>
> <transaction mode="BATCH"/>
> <!--
> This element specifies that the cache is clustered.
> modes supported: distribution (d), replication (r) or invalidation (i).
> http://community.jboss.org/wiki/Clusteringmodes
> -->
>
>
> </local-cache>
> <replicated-cache name="defaultCache" mode="ASYNC" queue-size="500" queue-flush-interval="10000">
>
> <state-transfer await-initial-transfer="false"
> timeout="240000"
> enabled="true"
> chunk-size="10000"
> />
> <!--Default write-skew is false, concurrency-level is 16 and acquire-timeout is 20 seconds in infinispan. Increasing -->
> <locking concurrency-level="1000" striping="true" acquire-timeout="240000"
> isolation="READ_COMMITTED" write-skew="false"/>
> <!-- <sync replTimeout="20000"/> -->
> <!-- async replication. -->
>
> </replicated-cache>
> </cache-container>
> </infinispan>
--
This message was sent by Atlassian JIRA
(v7.5.0#75005)
6 years, 6 months
[JBoss JIRA] (ISPN-9300) ReplicationQueue ISPN000072: Failed replicating XXX elements in replication queue org.infinispan.commons.CacheException: java.lang.RuntimeException: Failure to marshal argument(s
by Nilesh Deshpande (JIRA)
Nilesh Deshpande created ISPN-9300:
--------------------------------------
Summary: ReplicationQueue ISPN000072: Failed replicating XXX elements in replication queue org.infinispan.commons.CacheException: java.lang.RuntimeException: Failure to marshal argument(s
Key: ISPN-9300
URL: https://issues.jboss.org/browse/ISPN-9300
Project: Infinispan
Issue Type: Bug
Components: Core
Affects Versions: 7.2.2.Final
Reporter: Nilesh Deshpande
*I am getting continuous error in the log for following.*
ERROR 06/16 21:38:03.910 [replicationQueue-thread--p4-t1] o.i.r.ReplicationQueue ISPN000072: Failed replicating 114 elements in replication queue
org.infinispan.commons.CacheException: java.lang.RuntimeException: Failure to marshal argument(s)
at org.infinispan.commons.util.Util.rewrapAsCacheException(Util.java:657)
at org.infinispan.remoting.transport.jgroups.CommandAwareRpcDispatcher.invokeRemoteCommand(CommandAwareRpcDispatcher.java:250)
at org.infinispan.remoting.transport.jgroups.JGroupsTransport.invokeRemotely(JGroupsTransport.java:561)
at org.infinispan.remoting.rpc.RpcManagerImpl.invokeRemotely(RpcManagerImpl.java:287)
at org.infinispan.remoting.ReplicationQueueImpl.flush(ReplicationQueueImpl.java:152)
at org.infinispan.remoting.ReplicationQueueImpl$1.run(ReplicationQueueImpl.java:103)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.RuntimeException: Failure to marshal argument(s)
at org.infinispan.remoting.transport.jgroups.CommandAwareRpcDispatcher.marshallCall(CommandAwareRpcDispatcher.java:417)
at org.infinispan.remoting.transport.jgroups.CommandAwareRpcDispatcher.processSingleCall(CommandAwareRpcDispatcher.java:432)
at org.infinispan.remoting.transport.jgroups.CommandAwareRpcDispatcher.invokeRemoteCommand(CommandAwareRpcDispatcher.java:241)
... 11 common frames omitted
Caused by: java.util.ConcurrentModificationException: null
at java.util.HashMap$HashIterator.nextNode(HashMap.java:1442)
at java.util.HashMap$KeyIterator.next(HashMap.java:1466)
at org.infinispan.commons.marshall.MarshallUtil.marshallCollection(MarshallUtil.java:24)
at org.infinispan.marshall.exts.SetExternalizer.writeObject(SetExternalizer.java:44)
at org.infinispan.marshall.exts.SetExternalizer.writeObject(SetExternalizer.java:26)
at org.infinispan.marshall.core.ExternalizerTable$ExternalizerAdapter.writeObject(ExternalizerTable.java:442)
at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:144)
at org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1062)
at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1018)
at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:884)
at org.jboss.marshalling.AbstractObjectOutput.writeObject(AbstractObjectOutput.java:58)
at org.jboss.marshalling.AbstractMarshaller.writeObject(AbstractMarshaller.java:111)
at org.infinispan.marshall.exts.ReplicableCommandExternalizer.writeCommandParameters(ReplicableCommandExternalizer.java:58)
at org.infinispan.marshall.exts.ReplicableCommandExternalizer.writeObject(ReplicableCommandExternalizer.java:43)
at org.infinispan.marshall.exts.ReplicableCommandExternalizer.writeObject(ReplicableCommandExternalizer.java:31)
at org.infinispan.marshall.core.ExternalizerTable$ExternalizerAdapter.writeObject(ExternalizerTable.java:442)
at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:144)
at org.jboss.marshalling.AbstractObjectOutput.writeObject(AbstractObjectOutput.java:58)
at org.jboss.marshalling.AbstractMarshaller.writeObject(AbstractMarshaller.java:111)
at org.infinispan.marshall.exts.ReplicableCommandExternalizer.writeCommandParameters(ReplicableCommandExternalizer.java:58)
at org.infinispan.marshall.exts.CacheRpcCommandExternalizer.marshallParameters(CacheRpcCommandExternalizer.java:124)
at org.infinispan.marshall.exts.CacheRpcCommandExternalizer.writeObject(CacheRpcCommandExternalizer.java:108)
at org.infinispan.marshall.exts.CacheRpcCommandExternalizer.writeObject(CacheRpcCommandExternalizer.java:65)
at org.infinispan.marshall.core.ExternalizerTable$ExternalizerAdapter.writeObject(ExternalizerTable.java:442)
at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:144)
at org.jboss.marshalling.AbstractObjectOutput.writeObject(AbstractObjectOutput.java:58)
at org.jboss.marshalling.AbstractMarshaller.writeObject(AbstractMarshaller.java:111)
at org.infinispan.marshall.exts.ReplicableCommandExternalizer.writeCommandParameters(ReplicableCommandExternalizer.java:58)
at org.infinispan.marshall.exts.CacheRpcCommandExternalizer.marshallParameters(CacheRpcCommandExternalizer.java:124)
at org.infinispan.marshall.exts.CacheRpcCommandExternalizer.writeObject(CacheRpcCommandExternalizer.java:108)
at org.infinispan.marshall.exts.CacheRpcCommandExternalizer.writeObject(CacheRpcCommandExternalizer.java:65)
at org.infinispan.marshall.core.ExternalizerTable$ExternalizerAdapter.writeObject(ExternalizerTable.java:442)
at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:144)
at org.jboss.marshalling.AbstractObjectOutput.writeObject(AbstractObjectOutput.java:58)
at org.jboss.marshalling.AbstractMarshaller.writeObject(AbstractMarshaller.java:111)
at org.infinispan.commons.marshall.jboss.AbstractJBossMarshaller.objectToObjectStream(AbstractJBossMarshaller.java:72)
at org.infinispan.marshall.core.VersionAwareMarshaller.objectToBuffer(VersionAwareMarshaller.java:77)
at org.infinispan.commons.marshall.AbstractMarshaller.objectToBuffer(AbstractMarshaller.java:41)
at org.infinispan.commons.marshall.AbstractDelegatingMarshaller.objectToBuffer(AbstractDelegatingMarshaller.java:85)
at org.infinispan.remoting.transport.jgroups.MarshallerAdapter.objectToBuffer(MarshallerAdapter.java:23)
at org.infinispan.remoting.transport.jgroups.CommandAwareRpcDispatcher.marshallCall(CommandAwareRpcDispatcher.java:415)
... 13 common frames omitted
Caused by: org.jboss.marshalling.TraceInformation: null
*My cache setting is following*
<?xml version="1.0" encoding="UTF-8"?>
<infinispan
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:infinispan:config:7.0 http://www.infinispan.org/schemas/infinispan-config-7.0.xsd"
xmlns="urn:infinispan:config:7.0">
<jgroups>
<stack-file name="configurationFile" path="cache-replicator.conf"/>
</jgroups>
<cache-container default-cache="defaultCache">
<!--
Enables collection of global JMX statistics, and allows you to customize the JMX domain name under which
MBeans are registered.
-->
<jmx>
<property name="enabled">false</property>
<property name="jmxDomain">org.infinispan</property>
<property name="cacheManagerName">CacheManager</property>
<property name="statistics">false</property>
</jmx>
<!--
If the transport is omitted, there is no way to create distributed or clustered caches.
There is no added cost to defining a transport and not creating a cache that uses one, since the transport
is created and initialized lazily. By default, the JGroupsTransport is used.
Note that the JGroups transport uses sensible defaults if no configuration property is defined.
See:
http://community.jboss.org/wiki/ClusteredConfigurationQuickStart
http://docs.jboss.org/infinispan/5.0/apidocs/org/infinispan/remoting/tran...
-->
<transport cluster="TrueSight-Cache-cluster" stack="configurationFile">
</transport>
<!--
Used to register JVM shutdown hooks.
hookBehavior: DEFAULT, REGISTER, DONT_REGISTER
-->
<!-- <shutdown hookBehavior="DONT_REGISTER"/> -->
<local-cache name="defaultCache" statistics="false">
<!-- <storeAsBinary /> -->
<!--
Tunes the locking and concurrency characteristics of the cache.
See:
http://community.jboss.org/wiki/LockingandConcurrency
-->
<locking
isolation="READ_COMMITTED"
acquire-timeout="20000"
write-skew="false"
concurrency-level="5000"
striping="false"
/>
<!--
Used to register JMX statistics in any available MBean server
<jmxStatistics enabled="false"/>-->
<!--
Used to control whether objects stored in Infinispan nodes are primarily stored as rehydrated Objects or as
raw byte arrays. See:
http://community.jboss.org/wiki/Marshalling#Lazy_Deserialization
-->
<!-- <storeAsBinary enabled="true"/> -->
<!--
Used to enable invocation batching and allow the use of Cache.startBatch()/endBatch() methods.
http://community.jboss.org/wiki/Batching
<invocationBatching enabled="true"/> -->
<transaction mode="BATCH"/>
<!--
This element specifies that the cache is clustered.
modes supported: distribution (d), replication (r) or invalidation (i).
http://community.jboss.org/wiki/Clusteringmodes
-->
</local-cache>
<replicated-cache name="defaultCache" mode="ASYNC" queue-size="500" queue-flush-interval="10000">
<state-transfer await-initial-transfer="false"
timeout="240000"
enabled="true"
chunk-size="10000"
/>
<!--Default write-skew is false, concurrency-level is 16 and acquire-timeout is 20 seconds in infinispan. Increasing -->
<locking concurrency-level="1000" striping="true" acquire-timeout="240000"
isolation="READ_COMMITTED" write-skew="false"/>
<!-- <sync replTimeout="20000"/> -->
<!-- async replication. -->
</replicated-cache>
</cache-container>
</infinispan>
--
This message was sent by Atlassian JIRA
(v7.5.0#75005)
6 years, 6 months
[JBoss JIRA] (IPROTO-56) DynamicEntity support in MarshallerProvider
by Gustavo Fernandes (JIRA)
[ https://issues.jboss.org/browse/IPROTO-56?page=com.atlassian.jira.plugin.... ]
Gustavo Fernandes updated IPROTO-56:
------------------------------------
Steps to Reproduce:
Add the test to the protostream project:
{code:java}
package org.infinispan.protostream.impl;
import static java.util.Arrays.asList;
import static java.util.stream.Collectors.toList;
import static org.junit.Assert.assertEquals;
import java.io.IOException;
import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;
import org.infinispan.protostream.BaseMarshaller;
import org.infinispan.protostream.FileDescriptorSource;
import org.infinispan.protostream.MessageMarshaller;
import org.infinispan.protostream.ProtobufUtil;
import org.infinispan.protostream.SerializationContext;
import org.infinispan.protostream.config.Configuration;
import org.infinispan.protostream.descriptors.Descriptor;
import org.infinispan.protostream.descriptors.Type;
import org.junit.Test;
public class DynamicEntityTest {
private SerializationContextImpl createContext() {
return (SerializationContextImpl) ProtobufUtil.newSerializationContext(Configuration.builder().build());
}
// Inner class, represents the properties of the Dynamic Entity
class Child<T> {
String key;
T property;
Child(String key, T property) {
this.key = key;
this.property = property;
}
}
// Dynamic entity
class DynamicEntity {
int id;
String type;
List<Child<?>> children;
DynamicEntity(int id, String type, List<Child<?>> children) {
this.id = id;
this.type = type;
this.children = children;
}
private String generateProto() {
StringBuilder proto = new StringBuilder();
AtomicInteger fieldNumber = new AtomicInteger();
proto.append("message ").append(type).append(" {\n");
proto.append("required int32 ").append("id").append("=").append(fieldNumber.incrementAndGet()).append(";\n");
proto.append("required string ").append("type").append("=").append(fieldNumber.incrementAndGet()).append(";\n");
children.forEach(c -> {
String type = c.property instanceof Integer ? "int32" : "string";
proto.append("required ").append(type).append(" ").append(c.key).append("=").append(fieldNumber.incrementAndGet()).append(";\n");
});
return proto.append(" } ").toString();
}
}
// The Marshaller for the DynamicEntity
class EntityMarshaller implements MessageMarshaller<DynamicEntity> {
private String type;
EntityMarshaller(String type) {
this.type = type;
}
@Override
public DynamicEntity readFrom(ProtoStreamReader reader) throws IOException {
Descriptor descriptor = reader.getSerializationContext().getMessageDescriptor(this.getTypeName());
int id = reader.readInt("id");
String type = reader.readString("type");
List<Child<?>> children = descriptor.getFields().stream()
.filter(fd -> !fd.getName().equals("id") && !fd.getName().equals("type"))
.map(field -> {
try {
String name = field.getName();
Object value;
if (field.getType() == Type.INT32) {
value = reader.readInt(name);
} else {
value = reader.readString(name);
}
return new Child<>(field.getName(), value);
} catch (Exception ignored) {
return null;
}
})
.collect(toList());
return new DynamicEntity(id, type, children);
}
@Override
public void writeTo(ProtoStreamWriter writer, DynamicEntity topLevel) throws IOException {
writer.writeInt("id", topLevel.id);
writer.writeString("type", topLevel.type);
topLevel.children.forEach(c -> {
try {
String name = c.key;
Object value = c.property;
if (value instanceof Integer) {
writer.writeInt(name, (Integer) value);
} else {
writer.writeString(name, value.toString());
}
} catch (Exception ignored) {
}
});
}
@Override
public Class<? extends DynamicEntity> getJavaClass() {
return DynamicEntity.class;
}
@Override
public String getTypeName() {
return type;
}
}
@Test
public void testMarshallerProviderDynamicTypes() throws IOException {
// Create two dynamic types
DynamicEntity dynamicEntity = new DynamicEntity(1, "type1",
asList(new Child<>("eyes", "blue"), new Child<>("age", 23)));
DynamicEntity otherDynamicEntity = new DynamicEntity(2, "type2",
asList(new Child<>("country", "Jamaica"), new Child<>("currency", "jmd")));
// Auto generate the proto file from the entities and register them
SerializationContextImpl ctx = createContext();
String protoFile1 = dynamicEntity.generateProto();
String protoFile2 = otherDynamicEntity.generateProto();
System.out.println(protoFile1);
System.out.println(protoFile2);
ctx.registerProtoFiles(new FileDescriptorSource()
.addProtoFile(dynamicEntity.type + ".proto", protoFile1)
.addProtoFile(otherDynamicEntity.type + ".proto", protoFile2));
// Register a marshaller provider
ctx.registerMarshallerProvider(new SerializationContext.MarshallerProvider() {
@Override
public BaseMarshaller<?> getMarshaller(String typeName) {
return new EntityMarshaller(typeName);
}
@Override
public BaseMarshaller<?> getMarshaller(Class<?> javaClass) {
// HARDCODED, the marshaller requires a type but it cannot infer from a class, it'd need access to the instance
return new EntityMarshaller("type1");
}
});
byte[] bytes = ProtobufUtil.toByteArray(ctx, dynamicEntity);
DynamicEntity input = ProtobufUtil.fromByteArray(ctx, bytes, DynamicEntity.class);
assertEquals(1, input.id);
assertEquals("type1", input.type);
assertEquals(2, input.children.size());
Child<?> first = input.children.get(0);
assertEquals("eyes", first.key);
assertEquals("blue", first.property);
Child<?> second = input.children.get(1);
assertEquals("age", second.key);
assertEquals(23, second.property);
// Does not work with other types...
// byte[] anotherBytes = ProtobufUtil.toByteArray(ctx, otherDynamicEntity);
// DynamicEntity anotherInput = ProtobufUtil.fromByteArray(ctx, bytes, DynamicEntity.class);
}
}
{code}
was:
Add the test to the protostream project:
{code:java}
package org.infinispan.protostream.impl;
import static java.util.Arrays.asList;
import static java.util.stream.Collectors.toList;
import static org.junit.Assert.assertEquals;
import java.io.IOException;
import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;
import org.infinispan.protostream.BaseMarshaller;
import org.infinispan.protostream.FileDescriptorSource;
import org.infinispan.protostream.MessageMarshaller;
import org.infinispan.protostream.ProtobufUtil;
import org.infinispan.protostream.SerializationContext;
import org.infinispan.protostream.config.Configuration;
import org.infinispan.protostream.descriptors.Descriptor;
import org.infinispan.protostream.descriptors.Type;
import org.junit.Test;
public class DynamicEntityTest {
private SerializationContextImpl createContext() {
return (SerializationContextImpl) ProtobufUtil.newSerializationContext(Configuration.builder().build());
}
// Inner class, represents the properties of the Dynamic Entity
class Child<T> {
String key;
T property;
Child(String key, T property) {
this.key = key;
this.property = property;
}
}
// Dynamic entity
class DynamicEntity {
int id;
String type;
List<Child<?>> children;
DynamicEntity(int id, String type, List<Child<?>> children) {
this.id = id;
this.type = type;
this.children = children;
}
private String generateProto() {
StringBuilder proto = new StringBuilder();
AtomicInteger fieldNumber = new AtomicInteger();
proto.append("message ").append(type).append(" {\n");
proto.append("required int32 ").append("id").append("=").append(fieldNumber.incrementAndGet()).append(";\n");
proto.append("required string ").append("type").append("=").append(fieldNumber.incrementAndGet()).append(";\n");
children.forEach(c -> {
String type = c.property instanceof Integer ? "int32" : "string";
proto.append("required ").append(type).append(" ").append(c.key).append("=").append(fieldNumber.incrementAndGet()).append(";\n");
});
return proto.append(" } ").toString();
}
}
// The Marshaller for the DynamicEntity
class EntityMarshaller implements MessageMarshaller<DynamicEntity> {
private String type;
EntityMarshaller(String type) {
this.type = type;
}
@Override
public DynamicEntity readFrom(ProtoStreamReader reader) throws IOException {
Descriptor descriptor = reader.getSerializationContext().getMessageDescriptor(this.getTypeName());
int id = reader.readInt("id");
String type = reader.readString("type");
List<Child<?>> children = descriptor.getFields().stream()
.filter(fd -> !fd.getName().equals("id") && !fd.getName().equals("type"))
.map(field -> {
try {
String name = field.getName();
Object value;
if (field.getType() == Type.INT32) {
value = reader.readInt(name);
} else {
value = reader.readString(name);
}
return new Child<>(field.getName(), value);
} catch (Exception ignored) {
return null;
}
})
.collect(toList());
return new DynamicEntity(id, type, children);
}
@Override
public void writeTo(ProtoStreamWriter writer, DynamicEntity topLevel) throws IOException {
writer.writeInt("id", topLevel.id);
writer.writeString("type", topLevel.type);
topLevel.children.forEach(c -> {
try {
String name = c.key;
Object value = c.property;
if (value instanceof Integer) {
writer.writeInt(name, (Integer) value);
} else {
writer.writeString(name, value.toString());
}
} catch (Exception ignored) {
}
});
}
@Override
public Class<? extends DynamicEntity> getJavaClass() {
return DynamicEntity.class;
}
@Override
public String getTypeName() {
return type;
}
}
@Test
public void testMarshallerProviderDynamicTypes() throws IOException {
// Create two dynamic types
DynamicEntity dynamicEntity = new DynamicEntity(1, "type1",
asList(new Child<>("eyes", "blue"), new Child<>("age", 23)));
DynamicEntity otherDynamicEntity = new DynamicEntity(2, "type2",
asList(new Child<>("country", "Jamaica"), new Child<>("currency", "jmd")));
// Auto generate the proto file from the entities and register them
SerializationContextImpl ctx = createContext();
String protoFile1 = dynamicEntity.generateProto();
String protoFile2 = otherDynamicEntity.generateProto();
System.out.println(protoFile1);
System.out.println(protoFile2);
ctx.registerProtoFiles(new FileDescriptorSource()
.addProtoFile(dynamicEntity.type + ".proto", protoFile1)
.addProtoFile(otherDynamicEntity.type + ".proto", protoFile2));
// Register a marshaller provider
ctx.registerMarshallerProvider(new SerializationContext.MarshallerProvider() {
@Override
public BaseMarshaller<?> getMarshaller(String typeName) {
return new EntityMarshaller(typeName);
}
@Override
public BaseMarshaller<?> getMarshaller(Class<?> javaClass) {
// HARDCODED, ideally it should be able to expose to obtain the 'type' from the class
return new EntityMarshaller("type1");
}
});
byte[] bytes = ProtobufUtil.toByteArray(ctx, dynamicEntity);
DynamicEntity input = ProtobufUtil.fromByteArray(ctx, bytes, DynamicEntity.class);
assertEquals(1, input.id);
assertEquals("type1", input.type);
assertEquals(2, input.children.size());
Child<?> first = input.children.get(0);
assertEquals("eyes", first.key);
assertEquals("blue", first.property);
Child<?> second = input.children.get(1);
assertEquals("age", second.key);
assertEquals(23, second.property);
// Does not work with other types...
// byte[] anotherBytes = ProtobufUtil.toByteArray(ctx, otherDynamicEntity);
// DynamicEntity anotherInput = ProtobufUtil.fromByteArray(ctx, bytes, DynamicEntity.class);
}
}
{code}
> DynamicEntity support in MarshallerProvider
> -------------------------------------------
>
> Key: IPROTO-56
> URL: https://issues.jboss.org/browse/IPROTO-56
> Project: Infinispan ProtoStream
> Issue Type: Bug
> Reporter: Gustavo Fernandes
>
> The use case is a class that describe the entity. This class contains a 'type' and a list of properties. MarshallerProvider is used to associate a type with a marshaller that uses this 'type' to understand the fields and data types to read/write the stream.
> The type of the entity is contained in the entity itself, and when reading from the stream, this type is used to figure out the fields to read. During writes, though, the type is not involved so it's not possible to use the same strategy.
> Attached is a unit test to illustrate the situation. This is not necessarily a bug, it may be possible to achieve the usage of Dynamic Entities under other circumstances, or maybe the API needs to be extended.
--
This message was sent by Atlassian JIRA
(v7.5.0#75005)
6 years, 6 months
[JBoss JIRA] (IPROTO-56) DynamicEntity support in MarshallerProvider
by Gustavo Fernandes (JIRA)
[ https://issues.jboss.org/browse/IPROTO-56?page=com.atlassian.jira.plugin.... ]
Gustavo Fernandes edited comment on IPROTO-56 at 6/15/18 10:29 AM:
-------------------------------------------------------------------
One solution (or hack), similar to OGM, is to have a ThreadLocal object that would store the type. The MarshallerProvider would then use this storage to return the correct marshaller:
{code:java}
class MarshallerProvider implements SerializationContext.MarshallerProvider {
...
public MarshallerProvider(ThreadLocalStorage typeContainer) {
this.threadLocalStorage = ...
}
@Override
public BaseMarshaller<?> getMarshaller(Class<?> javaClass) {
return new EntityMarshaller(threadLocalStorage.getType());
}
{code}
This solution needs careful testing, as it's not guaranteed that the SerCtx used to marshall and unmarshall will come from the same thread (this happens in the Hot Rod client).
EDIT: will also require some decoration around protostream marshallers and classes, as it needs to write to the threadlocal storage depending on the instance being serialized
was (Author: gustavonalle):
One solution (or hack), similar to OGM, is to have a ThreadLocal object that would store the type. The MarshallerProvider would then use this storage to return the correct marshaller:
{code:java}
class MarshallerProvider implements SerializationContext.MarshallerProvider {
...
public MarshallerProvider(ThreadLocalStorage typeContainer) {
this.threadLocalStorage = ...
}
@Override
public BaseMarshaller<?> getMarshaller(Class<?> javaClass) {
return new EntityMarshaller(threadLocalStorage.getType());
}
{code}
This solution needs careful testing and as it's not guaranteed that the SerCtx is used to marshall and unmarshall from the same thread (this happens in the Hot Rod client).
EDIT: will also require some decoration around protostream marshallers and classes, as it needs to write to the threadlocal storage depending on the instance being serialized
> DynamicEntity support in MarshallerProvider
> -------------------------------------------
>
> Key: IPROTO-56
> URL: https://issues.jboss.org/browse/IPROTO-56
> Project: Infinispan ProtoStream
> Issue Type: Bug
> Reporter: Gustavo Fernandes
>
> The use case is a class that describe the entity. This class contains a 'type' and a list of properties. MarshallerProvider is used to associate a type with a marshaller that uses this 'type' to understand the fields and data types to read/write the stream.
> The type of the entity is contained in the entity itself, and when reading from the stream, this type is used to figure out the fields to read. During writes, though, the type is not involved so it's not possible to use the same strategy.
> Attached is a unit test to illustrate the situation. This is not necessarily a bug, it may be possible to achieve the usage of Dynamic Entities under other circumstances, or maybe the API needs to be extended.
--
This message was sent by Atlassian JIRA
(v7.5.0#75005)
6 years, 6 months
[JBoss JIRA] (IPROTO-56) DynamicEntity support in MarshallerProvider
by Gustavo Fernandes (JIRA)
[ https://issues.jboss.org/browse/IPROTO-56?page=com.atlassian.jira.plugin.... ]
Gustavo Fernandes edited comment on IPROTO-56 at 6/15/18 10:05 AM:
-------------------------------------------------------------------
One solution (or hack), similar to OGM, is to have a ThreadLocal object that would store the type. The MarshallerProvider would then use this storage to return the correct marshaller:
{code:java}
class MarshallerProvider implements SerializationContext.MarshallerProvider {
...
public MarshallerProvider(ThreadLocalStorage typeContainer) {
this.threadLocalStorage = ...
}
@Override
public BaseMarshaller<?> getMarshaller(Class<?> javaClass) {
return new EntityMarshaller(threadLocalStorage.getType());
}
{code}
This solution needs careful testing and as it's not guaranteed that the SerCtx is used to marshall and unmarshall from the same thread (this happens in the Hot Rod client).
EDIT: will require some decoration around protostream marshallers and classes, as it needs to write to the threadlocal storage depending on the instance being serialized
was (Author: gustavonalle):
One solution (or hack), similar to OGM, is to have a ThreadLocal object that would store the type. The MarshallerProvider would then use this storage to return the correct marshaller:
{code:java}
class MarshallerProvider implements SerializationContext.MarshallerProvider {
...
public MarshallerProvider(ThreadLocalStorage typeContainer) {
this.threadLocalStorage = ...
}
@Override
public BaseMarshaller<?> getMarshaller(Class<?> javaClass) {
return new EntityMarshaller(threadLocalStorage.getType());
}
{code}
This solution needs careful testing and as it's not guaranteed that the SerCtx is used to marshall and unmarshall from the same thread (this happens in the Hot Rod client)
> DynamicEntity support in MarshallerProvider
> -------------------------------------------
>
> Key: IPROTO-56
> URL: https://issues.jboss.org/browse/IPROTO-56
> Project: Infinispan ProtoStream
> Issue Type: Bug
> Reporter: Gustavo Fernandes
>
> The use case is a class that describe the entity. This class contains a 'type' and a list of properties. MarshallerProvider is used to associate a type with a marshaller that uses this 'type' to understand the fields and data types to read/write the stream.
> The type of the entity is contained in the entity itself, and when reading from the stream, this type is used to figure out the fields to read. During writes, though, the type is not involved so it's not possible to use the same strategy.
> Attached is a unit test to illustrate the situation. This is not necessarily a bug, it may be possible to achieve the usage of Dynamic Entities under other circumstances, or maybe the API needs to be extended.
--
This message was sent by Atlassian JIRA
(v7.5.0#75005)
6 years, 6 months
[JBoss JIRA] (IPROTO-56) DynamicEntity support in MarshallerProvider
by Gustavo Fernandes (JIRA)
[ https://issues.jboss.org/browse/IPROTO-56?page=com.atlassian.jira.plugin.... ]
Gustavo Fernandes edited comment on IPROTO-56 at 6/15/18 10:05 AM:
-------------------------------------------------------------------
One solution (or hack), similar to OGM, is to have a ThreadLocal object that would store the type. The MarshallerProvider would then use this storage to return the correct marshaller:
{code:java}
class MarshallerProvider implements SerializationContext.MarshallerProvider {
...
public MarshallerProvider(ThreadLocalStorage typeContainer) {
this.threadLocalStorage = ...
}
@Override
public BaseMarshaller<?> getMarshaller(Class<?> javaClass) {
return new EntityMarshaller(threadLocalStorage.getType());
}
{code}
This solution needs careful testing and as it's not guaranteed that the SerCtx is used to marshall and unmarshall from the same thread (this happens in the Hot Rod client).
EDIT: will also require some decoration around protostream marshallers and classes, as it needs to write to the threadlocal storage depending on the instance being serialized
was (Author: gustavonalle):
One solution (or hack), similar to OGM, is to have a ThreadLocal object that would store the type. The MarshallerProvider would then use this storage to return the correct marshaller:
{code:java}
class MarshallerProvider implements SerializationContext.MarshallerProvider {
...
public MarshallerProvider(ThreadLocalStorage typeContainer) {
this.threadLocalStorage = ...
}
@Override
public BaseMarshaller<?> getMarshaller(Class<?> javaClass) {
return new EntityMarshaller(threadLocalStorage.getType());
}
{code}
This solution needs careful testing and as it's not guaranteed that the SerCtx is used to marshall and unmarshall from the same thread (this happens in the Hot Rod client).
EDIT: will require some decoration around protostream marshallers and classes, as it needs to write to the threadlocal storage depending on the instance being serialized
> DynamicEntity support in MarshallerProvider
> -------------------------------------------
>
> Key: IPROTO-56
> URL: https://issues.jboss.org/browse/IPROTO-56
> Project: Infinispan ProtoStream
> Issue Type: Bug
> Reporter: Gustavo Fernandes
>
> The use case is a class that describe the entity. This class contains a 'type' and a list of properties. MarshallerProvider is used to associate a type with a marshaller that uses this 'type' to understand the fields and data types to read/write the stream.
> The type of the entity is contained in the entity itself, and when reading from the stream, this type is used to figure out the fields to read. During writes, though, the type is not involved so it's not possible to use the same strategy.
> Attached is a unit test to illustrate the situation. This is not necessarily a bug, it may be possible to achieve the usage of Dynamic Entities under other circumstances, or maybe the API needs to be extended.
--
This message was sent by Atlassian JIRA
(v7.5.0#75005)
6 years, 6 months