[infinispan-issues] [JBoss JIRA] Created: (ISPN-1034) DefaultCacheManager becomes corrupted after component start Exception

Raman Gupta (JIRA) jira-events at lists.jboss.org
Tue Apr 5 15:09:33 EDT 2011


DefaultCacheManager becomes corrupted after component start Exception
---------------------------------------------------------------------

                 Key: ISPN-1034
                 URL: https://issues.jboss.org/browse/ISPN-1034
             Project: Infinispan
          Issue Type: Bug
          Components: Cache Server
    Affects Versions: 4.2.1.FINAL
         Environment: Linux zeus 2.6.35.11-83.fc14.x86_64 #1 SMP Mon Feb 7 07:06:44 UTC 2011 x86_64 x86_64 x86_64 GNU/Linux
            Reporter: Raman Gupta
            Assignee: Manik Surtani
            Priority: Minor


If Jgroups cluster startup throws an Exception the CacheManager becomes "corrupted", and a retry to get the cache from the CacheManager fails even with the underlying issue removed.

For example, with the following code:

=============================================================
private Cache initCache(String name)
{
    Cache cache;
    for(int i = 0; i < 2; i++)
    {
	try
	{
	    System.out.println(i + " cacheManager.getCache");
	    cache = cacheManager.getCache(name);

	    System.out.println(i + " cache.start()");
	    cache.start();

	    System.out.println(i + " done");
	    return cache;
	}
	catch (Exception e)
	{
	    System.out.println(i + " exception:");
	    e.printStackTrace(System.out);
	    try
	    {
		Thread.sleep(5000);
	    }
	    catch (InterruptedException e1)
	    {
		// ignore
	    }
	}
    }

    return null;
}
=============================================================

I can get the following output when JGroups does not start (due to an unrelated issue -- http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=7032558):

0 cacheManager.getCache
0 exception:
org.infinispan.CacheException: Unable to invoke method public abstract void org.infinispan.remoting.transport.Transport.start() on object 
	at org.infinispan.util.ReflectionUtil.invokeAccessibly(ReflectionUtil.java:174)
	at org.infinispan.factories.AbstractComponentRegistry$PrioritizedMethod.invoke(AbstractComponentRegistry.java:889)
	at org.infinispan.factories.AbstractComponentRegistry.internalStart(AbstractComponentRegistry.java:687)
	at org.infinispan.factories.AbstractComponentRegistry.start(AbstractComponentRegistry.java:589)
	at org.infinispan.factories.GlobalComponentRegistry.start(GlobalComponentRegistry.java:137)
	at org.infinispan.factories.ComponentRegistry.start(ComponentRegistry.java:137)
	at org.infinispan.CacheDelegate.start(CacheDelegate.java:323)
	at org.infinispan.manager.DefaultCacheManager.createCache(DefaultCacheManager.java:516)
	at org.infinispan.manager.DefaultCacheManager.getCache(DefaultCacheManager.java:439)
	at com.algo.msg.mobjectcache.InfinispanCacheStore.initCache(InfinispanCacheStore.java:105)
	at com.algo.msg.mobjectcache.InfinispanCacheStore.init(InfinispanCacheStore.java:88)
	at com.algo.msg.mobjectcache.InfinispanCacheStore.main(InfinispanCacheStore.java:396)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at com.intellij.rt.execution.application.AppMain.main(AppMain.java:115)
Caused by: java.lang.reflect.InvocationTargetException
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.infinispan.util.ReflectionUtil.invokeAccessibly(ReflectionUtil.java:171)
	... 16 more
Caused by: org.infinispan.CacheException: org.jgroups.ChannelException: unable to setup the protocol stack
	at org.infinispan.remoting.transport.jgroups.JGroupsTransport.buildChannel(JGroupsTransport.java:261)
	at org.infinispan.remoting.transport.jgroups.JGroupsTransport.initChannel(JGroupsTransport.java:211)
	at org.infinispan.remoting.transport.jgroups.JGroupsTransport.initChannelAndRPCDispatcher(JGroupsTransport.java:227)
	at org.infinispan.remoting.transport.jgroups.JGroupsTransport.start(JGroupsTransport.java:154)
	... 21 more
Caused by: org.jgroups.ChannelException: unable to setup the protocol stack
	at org.jgroups.JChannel.init(JChannel.java:1728)
	at org.jgroups.JChannel.<init>(JChannel.java:249)
	at org.jgroups.JChannel.<init>(JChannel.java:215)
	at org.infinispan.remoting.transport.jgroups.JGroupsTransport.buildChannel(JGroupsTransport.java:258)
	... 24 more
Caused by: java.net.SocketException: No such device
	at java.net.NetworkInterface.isUp0(Native Method)
	at java.net.NetworkInterface.isUp(NetworkInterface.java:327)
	at org.jgroups.util.Util.getAddress(Util.java:3406)
	at org.jgroups.util.Util.getNonLoopbackAddress(Util.java:3392)
	at org.jgroups.stack.Configurator.setDefaultValues(Configurator.java:726)
	at org.jgroups.stack.Configurator.setupProtocolStack(Configurator.java:114)
	at org.jgroups.stack.Configurator.setupProtocolStack(Configurator.java:53)
	at org.jgroups.stack.ProtocolStack.setup(ProtocolStack.java:534)
	at org.jgroups.JChannel.init(JChannel.java:1725)
	... 27 more
1 cacheManager.getCache
1 cache.start()
1 exception:
org.infinispan.CacheException: Unable to invoke method private void org.infinispan.transaction.xa.TransactionTable.start() on object 
	at org.infinispan.util.ReflectionUtil.invokeAccessibly(ReflectionUtil.java:174)
	at org.infinispan.factories.AbstractComponentRegistry$PrioritizedMethod.invoke(AbstractComponentRegistry.java:889)
	at org.infinispan.factories.AbstractComponentRegistry.internalStart(AbstractComponentRegistry.java:687)
	at org.infinispan.factories.AbstractComponentRegistry.start(AbstractComponentRegistry.java:589)
	at org.infinispan.factories.ComponentRegistry.start(ComponentRegistry.java:147)
	at org.infinispan.CacheDelegate.start(CacheDelegate.java:323)
	at com.algo.msg.mobjectcache.InfinispanCacheStore.initCache(InfinispanCacheStore.java:108)
	at com.algo.msg.mobjectcache.InfinispanCacheStore.init(InfinispanCacheStore.java:88)
	at com.algo.msg.mobjectcache.InfinispanCacheStore.main(InfinispanCacheStore.java:396)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at com.intellij.rt.execution.application.AppMain.main(AppMain.java:115)
Caused by: java.lang.reflect.InvocationTargetException
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.infinispan.util.ReflectionUtil.invokeAccessibly(ReflectionUtil.java:171)
	... 13 more
Caused by: java.lang.NullPointerException
	at org.infinispan.manager.DefaultCacheManager.addListener(DefaultCacheManager.java:562)
	at org.infinispan.transaction.xa.TransactionTable.start(TransactionTable.java:105)
	... 18 more


On the second attempt, the Exception is no longer the same, but rather a NPE in the DefaultCacheManager.

The NPE occurs EVEN WHEN the underlying cause of the first Exception(in my case a network interface that was causing JGroups channel init to fail) has been removed during the sleep time between the attempts, and therefore the program is stuck until a new DefaultCacheManager is created. With a dependency injection approach, creating a new manager for retries is not always feasible or desirable.


--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira


More information about the infinispan-issues mailing list