[JBoss JIRA] (JBCACHE-1617) ClassNotFoundException during replication with lazy deserialization
by Dennis Reed (JIRA)
Dennis Reed created JBCACHE-1617:
------------------------------------
Summary: ClassNotFoundException during replication with lazy deserialization
Key: JBCACHE-1617
URL: https://issues.jboss.org/browse/JBCACHE-1617
Project: JBoss Cache
Issue Type: Bug
Security Level: Public (Everyone can see)
Components: Replication
Affects Versions: 3.2.8.GA
Reporter: Dennis Reed
Assignee: Dennis Reed
Replicating a cache put tries to deserialize the original value on the remote nodes.
If the classloader of the JGroups call is not the correct classloader for the value, a ClassCastException occurs and aborts the put.
Since the value is never returned, it should not be deserialized.
ERROR [org.jboss.cache.interceptors.TxInterceptor] prepare failed!
org.jboss.cache.CacheException: Unable to unmarshall value
at org.jboss.cache.marshall.MarshalledValue.deserialize(MarshalledValue.java:117)
at org.jboss.cache.marshall.MarshalledValue.get(MarshalledValue.java:177)
at org.jboss.cache.interceptors.MarshalledValueInterceptor.processRetVal(MarshalledValueInterceptor.java:181)
at org.jboss.cache.interceptors.MarshalledValueInterceptor.compactAndProcessRetVal(MarshalledValueInterceptor.java:172)
at org.jboss.cache.interceptors.MarshalledValueInterceptor.visitPutKeyValueCommand(MarshalledValueInterceptor.java:109)
at org.jboss.cache.commands.write.PutKeyValueCommand.acceptVisitor(PutKeyValueCommand.java:100)
at org.jboss.cache.interceptors.base.CommandInterceptor.invokeNextInterceptor(CommandInterceptor.java:116)
at org.jboss.cache.interceptors.TxInterceptor.replayModifications(TxInterceptor.java:501)
at org.jboss.cache.interceptors.TxInterceptor.handleRemotePrepare(TxInterceptor.java:388)
at org.jboss.cache.interceptors.TxInterceptor.visitPrepareCommand(TxInterceptor.java:134)
...
[JGroups RPC call]
Caused by: java.lang.ClassNotFoundException: com.example.MyClass
...
at java.lang.Class.forName(Class.java:247)
at org.jboss.util.stream.MarshalledValueInputStream.resolveClass(MarshalledValueInputStream.java:81)
...
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
12 years, 2 months
[JBoss JIRA] (JBCACHE-1625) Logging level is cached
by Dennis Reed (JIRA)
Dennis Reed created JBCACHE-1625:
------------------------------------
Summary: Logging level is cached
Key: JBCACHE-1625
URL: https://issues.jboss.org/browse/JBCACHE-1625
Project: JBoss Cache
Issue Type: Bug
Security Level: Public (Everyone can see)
Affects Versions: 3.2.8.GA
Reporter: Dennis Reed
Assignee: Dennis Reed
JBoss Cache makes extensive use of the following pattern:
private static final boolean trace = log.isTraceEnabled();
...
if (trace) log.trace("foo " + foo);
This is an anti-pattern that prevents the log level from being changed dynamically without restarting the JVM.
The logging level should not be cached, but checked on each statement:
if (log.isTraceEnabled()) log.trace("foo " + foo);
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
12 years, 4 months
[JBoss JIRA] (JBCACHE-1622) failed setting transient state
by Peter Chen (JIRA)
Peter Chen created JBCACHE-1622:
-----------------------------------
Summary: failed setting transient state
Key: JBCACHE-1622
URL: https://issues.jboss.org/browse/JBCACHE-1622
Project: JBoss Cache
Issue Type: Bug
Affects Versions: 1.4.1.SP3
Environment: Unix, Jboss4 cluster 6 nodes, oracle
Reporter: Peter Chen
Assignee: Manik Surtani
Could any one advise the root reason for following error:
2012-07-10 11:40:37,613 ERROR [org.jboss.cache.TreeCache] failed setting
transient state
java.lang.IndexOutOfBoundsException: Index: 1, Size: 1
at java.util.ArrayList.RangeCheck(ArrayList.java:546)
at java.util.ArrayList.get(ArrayList.java:321)
at org.jboss.cache.Fqn.get(Fqn.java:257)
at org.jboss.cache.statetransfer.StateTransferIntegrator_140.integrateRetainedNode(StateTransferIntegrator_140.java:373)
at org.jboss.cache.statetransfer.StateTransferIntegrator_140.integrateRetainedNode(StateTransferIntegrator_140.java:405)
at org.jboss.cache.statetransfer.StateTransferIntegrator_140.integrateRetainedNodes(StateTransferIntegrator_140.java:364)
at org.jboss.cache.statetransfer.StateTransferIntegrator_140.integrateTransientState(StateTransferIntegrator_140.java:236)
at org.jboss.cache.statetransfer.StateTransferIntegrator_140.integrateTransientState(StateTransferIntegrator_140.java:100)
at org.jboss.cache.TreeCache._setState(TreeCache.java:2809)
at org.jboss.cache.TreeCache.access$000(TreeCache.java:106)
at org.jboss.cache.TreeCache$MessageListenerAdaptor.setState(TreeCache.java:5637)
at org.jgroups.blocks.MessageDispatcher$ProtocolAdapter.passUp(MessageDispatcher.java:692)
at org.jgroups.blocks.RequestCorrelator.receive(RequestCorrelator.java:372)
at org.jgroups.blocks.MessageDispatcher$ProtocolAdapter.up(MessageDispatcher.java:777)
at org.jgroups.JChannel.up(JChannel.java:1030)
at org.jgroups.stack.ProtocolStack.up(ProtocolStack.java:382)
at org.jgroups.stack.ProtocolStack.receiveUpEvent(ProtocolStack.java:398)
at org.jgroups.stack.Protocol.passUp(Protocol.java:520)
at org.jgroups.protocols.pbcast.STATE_TRANSFER.handleStateRsp(STATE_TRANSFER.java:438)
at org.jgroups.protocols.pbcast.STATE_TRANSFER.up(STATE_TRANSFER.java:147)
at org.jgroups.stack.Protocol.receiveUpEvent(Protocol.java:470)
at org.jgroups.stack.Protocol.passUp(Protocol.java:520)
at org.jgroups.protocols.FRAG2.unfragment(FRAG2.java:286)
at org.jgroups.protocols.FRAG2.up(FRAG2.java:182)
at org.jgroups.stack.Protocol.receiveUpEvent(Protocol.java:470)
at org.jgroups.stack.Protocol.passUp(Protocol.java:520)
at org.jgroups.protocols.FC.up(FC.java:422)
at org.jgroups.stack.Protocol.receiveUpEvent(Protocol.java:470)
at org.jgroups.stack.Protocol.passUp(Protocol.java:520)
at org.jgroups.protocols.pbcast.GMS.up(GMS.java:768)
at org.jgroups.stack.Protocol.receiveUpEvent(Protocol.java:470)
at org.jgroups.protocols.pbcast.GMS.receiveUpEvent(GMS.java:788)
at org.jgroups.stack.Protocol.passUp(Protocol.java:520)
at org.jgroups.protocols.pbcast.STABLE.up(STABLE.java:258)
at org.jgroups.stack.Protocol.receiveUpEvent(Protocol.java:470)
at org.jgroups.stack.Protocol.passUp(Protocol.java:520)
at org.jgroups.protocols.UNICAST.handleDataReceived(UNICAST.java:516)
at org.jgroups.protocols.UNICAST.up(UNICAST.java:242)
at org.jgroups.stack.Protocol.receiveUpEvent(Protocol.java:470)
at org.jgroups.stack.Protocol.passUp(Protocol.java:520)
at org.jgroups.protocols.pbcast.NAKACK.up(NAKACK.java:569)
at org.jgroups.stack.Protocol.receiveUpEvent(Protocol.java:470)
at org.jgroups.stack.Protocol.passUp(Protocol.java:520)
at org.jgroups.protocols.VERIFY_SUSPECT.up(VERIFY_SUSPECT.java:170)
at org.jgroups.stack.Protocol.receiveUpEvent(Protocol.java:470)
at org.jgroups.stack.Protocol.passUp(Protocol.java:520)
at org.jgroups.protocols.FD.up(FD.java:300)
at org.jgroups.stack.Protocol.receiveUpEvent(Protocol.java:470)
at org.jgroups.stack.Protocol.passUp(Protocol.java:520)
at org.jgroups.protocols.FD_SOCK.up(FD_SOCK.java:301)
at org.jgroups.stack.Protocol.receiveUpEvent(Protocol.java:470)
at org.jgroups.stack.Protocol.passUp(Protocol.java:520)
at org.jgroups.protocols.MERGE2.up(MERGE2.java:162)
at org.jgroups.stack.Protocol.receiveUpEvent(Protocol.java:470)
at org.jgroups.stack.Protocol.passUp(Protocol.java:520)
at org.jgroups.protocols.Discovery.up(Discovery.java:225)
at org.jgroups.stack.Protocol.receiveUpEvent(Protocol.java:470)
at org.jgroups.stack.Protocol.passUp(Protocol.java:520)
at org.jgroups.protocols.TP.handleIncomingMessage(TP.java:908)
at org.jgroups.protocols.TP.handleIncomingPacket(TP.java:850)
at org.jgroups.protocols.TP.access$400(TP.java:45)
at org.jgroups.protocols.TP$IncomingPacketHandler.run(TP.java:1296)
at java.lang.Thread.run(Thread.java:595)
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
12 years, 4 months
[JBoss JIRA] (JBCACHE-394) Performance Improvements in CachedSetImpl
by Scott Marlow (JIRA)
[ https://issues.jboss.org/browse/JBCACHE-394?page=com.atlassian.jira.plugi... ]
Scott Marlow reassigned JBCACHE-394:
------------------------------------
Assignee: Scott Marlow (was: Scott Marlow (Novell))
> Performance Improvements in CachedSetImpl
> -----------------------------------------
>
> Key: JBCACHE-394
> URL: https://issues.jboss.org/browse/JBCACHE-394
> Project: JBoss Cache
> Issue Type: Patch
> Security Level: Public(Everyone can see)
> Components: Legacy POJO Cache
> Reporter: Brian Stansberry
> Assignee: Scott Marlow
> Fix For: 1.3.0.GA
>
> Attachments: CachedSetImpl.diff, CachedSetImpl.java
>
>
> Jussi Pyörre posted a revised version of CachedSetImpl on the user forum. I haven't evaluated it, but am moving it to JIRA so we don't lose track of it.
> From the forum post:
> As I was running into severe performance problems with CachedSetImpl in TreeCacheAop, I wrote a new version with increased performance (can't remember the exact amount of improvement, but it was substantial anyway). This version has two main improvements:
> 1. The older version used size() method several times in next() method of the IteratorImpl. Since size() is a quite heavy operation in CachedSetImpl, the performance was poor. New version doesn't use size() for iterations at all.
> 2. The old version used ArrayList style indexing for node children names. This was only slowing things down. The new version uses the first available integer as a new child's name. For example, if first there were three children (0, 1 and 2) and '1' was destroyed, '0' and '2' would not get renamed. The next element addition would use '1' as its child name.
> As I am currently really busy, I unfortunately don't have time to get familiar with your ways of contributing to source code, so I'll just publish the new version here. So, here's the new CachedSetImpl:
> Code:
> /*
> * JBoss, the OpenSource J2EE webOS
> *
> * Distributable under LGPL license.
> * See terms of license at gnu.org.
> */
> package org.jboss.cache.aop.collection;
> import org.jboss.cache.CacheException;
> import org.jboss.cache.Fqn;
> import org.jboss.cache.DataNode;
> import org.jboss.cache.aop.TreeCacheAop;
> import org.jboss.cache.aop.util.AopUtil;
> import org.jboss.util.NestedRuntimeException;
> import java.util.AbstractSet;
> import java.util.Collection;
> import java.util.Collections;
> import java.util.Iterator;
> import java.util.Map;
> import java.util.NoSuchElementException;
> import java.util.Set;
> /**
> * Set that uses cache as a underlying backend store
> *
> * @author Ben Wang, Jussi Pyörre
> */
> public class CachedSetImpl extends AbstractSet {
> protected TreeCacheAop cache;
> protected AbstractCollectionInterceptor interceptor;
> public CachedSetImpl(TreeCacheAop cache,
> AbstractCollectionInterceptor interceptor) {
> this.cache = cache;
> this.interceptor = interceptor;
> }
> private Collection keySet() {
> DataNode node = getNode();
> if (node != null) {
> Map children = node.getChildren();
> if (children != null) {
> return children.keySet();
> }
> }
> return Collections.EMPTY_SET;
> }
> private class IteratorImpl implements Iterator {
> private Iterator iterator;
> private Object key;
> private IteratorImpl(Collection keys) {
> iterator = keys.iterator();
> }
> private IteratorImpl() {
> iterator = CachedSetImpl.this.keySet().iterator();
> }
> public boolean hasNext() {
> return iterator.hasNext();
> }
> public Object next() throws NoSuchElementException {
> if (!this.hasNext()) {
> throw new NoSuchElementException();
> }
> this.key = iterator.next();
> try {
> return cache
> .getObject(AopUtil.constructFqn(getFqn(), this.key));
> } catch (CacheException e) {
> throw new RuntimeException(e);
> }
> }
> public void remove() throws IllegalStateException {
> if (this.key == null) {
> throw new IllegalStateException();
> }
> try {
> cache.removeObject(AopUtil.constructFqn(getFqn(), this.key));
> } catch (CacheException e) {
> throw new RuntimeException(e);
> }
> }
> }
> // protected static final Log log_=LogFactory.getLog(CachedSetImpl.class);
> protected DataNode getNode() {
> try {
> return cache.get(getFqn());
> } catch (Exception e) {
> throw new NestedRuntimeException(e);
> }
> }
> protected Fqn getFqn() {
> // Need this since fqn can be reset.
> return interceptor.getFqn();
> }
> public boolean add(Object o) {
> Collection keys = keySet();
> // This could be done with 'contains(o)' but it would invoke 'keySet()'
> // twice
> for (Iterator iter = new IteratorImpl(keys); iter.hasNext();)
> if (iter.next() == o)
> return false;
> // Search first available key. This is a fast operation as the key set
> // is already available
> int key = 0;
> while (keys.contains(Integer.toString(key)))
> key++;
> try {
> cache.putObject(AopUtil.constructFqn(getFqn(), Integer
> .toString(key)), o);
> } catch (CacheException e) {
> throw new RuntimeException(e);
> }
> return true;
> }
> public Iterator iterator() {
> return new IteratorImpl();
> }
> public int size() {
> return keySet().size();
> }
> public boolean equals(Object o) {
> if (o == null)
> return false;
> if (o == this)
> return true;
> try {
> Set set = (Set) o;
> return (set.size() == keySet().size() && this.containsAll(set));
> } catch (ClassCastException e) {
> return false;
> }
> }
> }
>
> It might need modification with older JDKs with rethrowing of catched exceptions (I use RuntimeException as you seem to throw NestedRuntimeException...). Anyway, that is a minor modification, if needed.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
12 years, 4 months
[JBoss JIRA] (JBCACHE-394) Performance Improvements in CachedSetImpl
by Scott Marlow (JIRA)
[ https://issues.jboss.org/browse/JBCACHE-394?page=com.atlassian.jira.plugi... ]
Scott Marlow closed JBCACHE-394.
--------------------------------
> Performance Improvements in CachedSetImpl
> -----------------------------------------
>
> Key: JBCACHE-394
> URL: https://issues.jboss.org/browse/JBCACHE-394
> Project: JBoss Cache
> Issue Type: Patch
> Security Level: Public(Everyone can see)
> Components: Legacy POJO Cache
> Reporter: Brian Stansberry
> Assignee: Scott Marlow
> Fix For: 1.3.0.GA
>
> Attachments: CachedSetImpl.diff, CachedSetImpl.java
>
>
> Jussi Pyörre posted a revised version of CachedSetImpl on the user forum. I haven't evaluated it, but am moving it to JIRA so we don't lose track of it.
> From the forum post:
> As I was running into severe performance problems with CachedSetImpl in TreeCacheAop, I wrote a new version with increased performance (can't remember the exact amount of improvement, but it was substantial anyway). This version has two main improvements:
> 1. The older version used size() method several times in next() method of the IteratorImpl. Since size() is a quite heavy operation in CachedSetImpl, the performance was poor. New version doesn't use size() for iterations at all.
> 2. The old version used ArrayList style indexing for node children names. This was only slowing things down. The new version uses the first available integer as a new child's name. For example, if first there were three children (0, 1 and 2) and '1' was destroyed, '0' and '2' would not get renamed. The next element addition would use '1' as its child name.
> As I am currently really busy, I unfortunately don't have time to get familiar with your ways of contributing to source code, so I'll just publish the new version here. So, here's the new CachedSetImpl:
> Code:
> /*
> * JBoss, the OpenSource J2EE webOS
> *
> * Distributable under LGPL license.
> * See terms of license at gnu.org.
> */
> package org.jboss.cache.aop.collection;
> import org.jboss.cache.CacheException;
> import org.jboss.cache.Fqn;
> import org.jboss.cache.DataNode;
> import org.jboss.cache.aop.TreeCacheAop;
> import org.jboss.cache.aop.util.AopUtil;
> import org.jboss.util.NestedRuntimeException;
> import java.util.AbstractSet;
> import java.util.Collection;
> import java.util.Collections;
> import java.util.Iterator;
> import java.util.Map;
> import java.util.NoSuchElementException;
> import java.util.Set;
> /**
> * Set that uses cache as a underlying backend store
> *
> * @author Ben Wang, Jussi Pyörre
> */
> public class CachedSetImpl extends AbstractSet {
> protected TreeCacheAop cache;
> protected AbstractCollectionInterceptor interceptor;
> public CachedSetImpl(TreeCacheAop cache,
> AbstractCollectionInterceptor interceptor) {
> this.cache = cache;
> this.interceptor = interceptor;
> }
> private Collection keySet() {
> DataNode node = getNode();
> if (node != null) {
> Map children = node.getChildren();
> if (children != null) {
> return children.keySet();
> }
> }
> return Collections.EMPTY_SET;
> }
> private class IteratorImpl implements Iterator {
> private Iterator iterator;
> private Object key;
> private IteratorImpl(Collection keys) {
> iterator = keys.iterator();
> }
> private IteratorImpl() {
> iterator = CachedSetImpl.this.keySet().iterator();
> }
> public boolean hasNext() {
> return iterator.hasNext();
> }
> public Object next() throws NoSuchElementException {
> if (!this.hasNext()) {
> throw new NoSuchElementException();
> }
> this.key = iterator.next();
> try {
> return cache
> .getObject(AopUtil.constructFqn(getFqn(), this.key));
> } catch (CacheException e) {
> throw new RuntimeException(e);
> }
> }
> public void remove() throws IllegalStateException {
> if (this.key == null) {
> throw new IllegalStateException();
> }
> try {
> cache.removeObject(AopUtil.constructFqn(getFqn(), this.key));
> } catch (CacheException e) {
> throw new RuntimeException(e);
> }
> }
> }
> // protected static final Log log_=LogFactory.getLog(CachedSetImpl.class);
> protected DataNode getNode() {
> try {
> return cache.get(getFqn());
> } catch (Exception e) {
> throw new NestedRuntimeException(e);
> }
> }
> protected Fqn getFqn() {
> // Need this since fqn can be reset.
> return interceptor.getFqn();
> }
> public boolean add(Object o) {
> Collection keys = keySet();
> // This could be done with 'contains(o)' but it would invoke 'keySet()'
> // twice
> for (Iterator iter = new IteratorImpl(keys); iter.hasNext();)
> if (iter.next() == o)
> return false;
> // Search first available key. This is a fast operation as the key set
> // is already available
> int key = 0;
> while (keys.contains(Integer.toString(key)))
> key++;
> try {
> cache.putObject(AopUtil.constructFqn(getFqn(), Integer
> .toString(key)), o);
> } catch (CacheException e) {
> throw new RuntimeException(e);
> }
> return true;
> }
> public Iterator iterator() {
> return new IteratorImpl();
> }
> public int size() {
> return keySet().size();
> }
> public boolean equals(Object o) {
> if (o == null)
> return false;
> if (o == this)
> return true;
> try {
> Set set = (Set) o;
> return (set.size() == keySet().size() && this.containsAll(set));
> } catch (ClassCastException e) {
> return false;
> }
> }
> }
>
> It might need modification with older JDKs with rethrowing of catched exceptions (I use RuntimeException as you seem to throw NestedRuntimeException...). Anyway, that is a minor modification, if needed.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
12 years, 4 months