[jboss-jira] [JBoss JIRA] (WFLY-1335) cache container transport should be shareable or reusable

Mathieu Lachance (JIRA) jira-events at lists.jboss.org
Mon May 13 13:46:06 EDT 2013


Mathieu Lachance created WFLY-1335:
--------------------------------------

             Summary: cache container transport should be shareable or reusable
                 Key: WFLY-1335
                 URL: https://issues.jboss.org/browse/WFLY-1335
             Project: WildFly
          Issue Type: Bug
          Components: Clustering, Documentation
    Affects Versions: 8.0.0.Alpha1
         Environment: using 7.2.0.Final (https://github.com/wildfly/wildfly/tree/7.2.0.Final-testsuite-fix)
            Reporter: Mathieu Lachance
            Assignee: Paul Ferraro


when using multiple cache containers, if clustering is required for each cache container (i.e. container defines any clustered cache), if using the same transport (i.e. stack="...") an error occurs.

ex:
using web cache container with replicated sso cache +
hibernate cache container with local-query, entity and timestamps caches
{code}
16:57:27,411 ERROR [org.jboss.msc.service.fail] (ServerService Thread Pool -- 55) MSC00001: Failed to start service jboss.persistenceunit."xxxx.ear#xxxxDSJTA": org.jboss.msc.service.StartException in service jboss.persistenceunit."xxxx
        at org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1.run(PersistenceUnitServiceImpl.java:103)
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [rt.jar:1.6.0_35]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [rt.jar:1.6.0_35]
        at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_35]
        at org.jboss.threads.JBossThread.run(JBossThread.java:122)
Caused by: org.infinispan.manager.EmbeddedCacheManagerStartupException: org.infinispan.CacheException: Unable to invoke method public void org.infinispan.remoting.transport.jgroups.JGroupsTransport.start() on object of type JGroupsTransport
        at org.infinispan.factories.GlobalComponentRegistry.start(GlobalComponentRegistry.java:247)
        at org.infinispan.manager.DefaultCacheManager.wireAndStartCache(DefaultCacheManager.java:677)
        at org.infinispan.manager.DefaultCacheManager.createCache(DefaultCacheManager.java:649)
        at org.infinispan.manager.DefaultCacheManager.getCache(DefaultCacheManager.java:545)
        at org.infinispan.manager.DefaultCacheManager.getCache(DefaultCacheManager.java:559)
        at org.jboss.as.clustering.infinispan.DefaultEmbeddedCacheManager.getCache(DefaultEmbeddedCacheManager.java:109)
        at org.jboss.as.clustering.infinispan.DefaultEmbeddedCacheManager.getCache(DefaultEmbeddedCacheManager.java:100)
        at org.hibernate.cache.infinispan.InfinispanRegionFactory.getCache(InfinispanRegionFactory.java:526)
        at org.hibernate.cache.infinispan.InfinispanRegionFactory.buildEntityRegion(InfinispanRegionFactory.java:216)
        at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:348)
        at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1742)
        at org.hibernate.ejb.EntityManagerFactoryImpl.<init>(EntityManagerFactoryImpl.java:94)
        at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:905)
        at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:890)
        at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:74)
        at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.createContainerEntityManagerFactory(PersistenceUnitServiceImpl.java:200)
        at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.access$600(PersistenceUnitServiceImpl.java:57)
        at org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1.run(PersistenceUnitServiceImpl.java:99)
        ... 4 more
Caused by: org.infinispan.CacheException: Unable to invoke method public void org.infinispan.remoting.transport.jgroups.JGroupsTransport.start() on object of type JGroupsTransport
        at org.infinispan.util.ReflectionUtil.invokeAccessibly(ReflectionUtil.java:205)
        at org.infinispan.factories.AbstractComponentRegistry$PrioritizedMethod.invoke(AbstractComponentRegistry.java:883)
        at org.infinispan.factories.AbstractComponentRegistry.invokeStartMethods(AbstractComponentRegistry.java:654)
        at org.infinispan.factories.AbstractComponentRegistry.internalStart(AbstractComponentRegistry.java:643)
        at org.infinispan.factories.AbstractComponentRegistry.start(AbstractComponentRegistry.java:546)
        at org.infinispan.factories.GlobalComponentRegistry.start(GlobalComponentRegistry.java:225)
        ... 21 more
Caused by: org.infinispan.CacheException: Unable to start JGroups Channel
        at org.infinispan.remoting.transport.jgroups.JGroupsTransport.startJGroupsChannelIfNeeded(JGroupsTransport.java:209)
        at org.infinispan.remoting.transport.jgroups.JGroupsTransport.start(JGroupsTransport.java:198)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.6.0_35]
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [rt.jar:1.6.0_35]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [rt.jar:1.6.0_35]
        at java.lang.reflect.Method.invoke(Method.java:597) [rt.jar:1.6.0_35]
        at org.infinispan.util.ReflectionUtil.invokeAccessibly(ReflectionUtil.java:203)
        ... 26 more
Caused by: java.lang.Exception: connecting to channel "null" failed
        at org.jgroups.JChannel._connect(JChannel.java:542)
        at org.jgroups.JChannel.connect(JChannel.java:283)
        at org.jgroups.JChannel.connect(JChannel.java:268)
        at org.infinispan.remoting.transport.jgroups.JGroupsTransport.startJGroupsChannelIfNeeded(JGroupsTransport.java:207)
        ... 32 more
Caused by: java.lang.IllegalArgumentException: failed to start server socket
        at org.jgroups.protocols.FD_SOCK.down(FD_SOCK.java:308)
        at org.jgroups.protocols.FD.down(FD.java:290)
        at org.jgroups.protocols.VERIFY_SUSPECT.down(VERIFY_SUSPECT.java:80)
        at org.jgroups.protocols.pbcast.NAKACK2.down(NAKACK2.java:534)
        at org.jgroups.protocols.UNICAST2.down(UNICAST2.java:544)
        at org.jgroups.protocols.pbcast.STABLE.down(STABLE.java:329)
        at org.jgroups.protocols.pbcast.GMS.down(GMS.java:931)
        at org.jgroups.protocols.FlowControl.down(FlowControl.java:351)
        at org.jgroups.protocols.FlowControl.down(FlowControl.java:351)
        at org.jgroups.protocols.FRAG2.down(FRAG2.java:147)
        at org.jgroups.protocols.RSVP.down(RSVP.java:143)
        at org.jgroups.stack.ProtocolStack.down(ProtocolStack.java:1025)
        at org.jgroups.JChannel.down(JChannel.java:722)
        at org.jgroups.JChannel._connect(JChannel.java:536)
        ... 35 more
Caused by: java.net.BindException: bind_addr /0.0.0.0 is not a valid interface: java.net.BindException: Address already in use: JVM_Bind
        at org.jgroups.util.Util.createServerSocket(Util.java:3404)
        at org.jgroups.protocols.FD_SOCK.startServerSocket(FD_SOCK.java:568)
        at org.jgroups.protocols.FD_SOCK.down(FD_SOCK.java:305)
        ... 48 more
{code}

when looking at the traces :
web cache container is created, and a jgroups channel is created as it is the first to start, everything is ok.
then, hibernate/jpa initialization kick off, create the hibernate cache container, and try to create a second jgroups channel and fail as the first jgroups channel is already bound.
jgroups channel should have been reused.

to reproduce, here is my infinispan and jgroups subsystem :
{code:xml}
        <subsystem xmlns="urn:jboss:domain:infinispan:1.4">
            <cache-container name="web" aliases="standard-session-cache" default-cache="local-web" module="org.jboss.as.clustering.web.infinispan">
                <transport lock-timeout="60000"/>
                <local-cache name="local-web" batching="true">
                    <file-store passivation="false" purge="false"/>
                </local-cache>
                <replicated-cache name="sso" mode="SYNC" batching="true"/>
            </cache-container>
            <cache-container name="hibernate" default-cache="local-query" module="org.jboss.as.jpa.hibernate:4">
                <transport lock-timeout="60000"/>
                <local-cache name="local-query">
                    <transaction mode="NONE"/>
                    <eviction strategy="LRU" max-entries="10000"/>
                    <expiration max-idle="100000"/>
                </local-cache>
                <invalidation-cache name="entity" mode="SYNC">
                    <transaction mode="NON_XA"/>
                    <eviction strategy="LRU" max-entries="10000"/>
                    <expiration max-idle="100000"/>
                </invalidation-cache>
                <replicated-cache name="timestamps" mode="ASYNC">
                    <transaction mode="NONE"/>
                    <eviction strategy="NONE"/>
                </replicated-cache>
            </cache-container>
        </subsystem>
        <subsystem xmlns="urn:jboss:domain:jgroups:1.1" default-stack="tcp">
            <stack name="tcp">
                <transport type="TCP" socket-binding="jgroups-tcp" machine="lachance-pc" rack="rack1" site="site1"/>
                <protocol type="TCPPING">
                    <property name="initial_hosts">lachance-pc [8010]</property>
                    <property name="port_range">0</property>
                    <property name="num_initial_members">2</property>
                </protocol>
                <protocol type="MERGE2"/>
                <protocol type="FD_SOCK" socket-binding="jgroups-tcp-fd"/>
                <protocol type="FD"/>
                <protocol type="VERIFY_SUSPECT"/>
                <protocol type="pbcast.NAKACK2"/>
                <protocol type="UNICAST2"/>
                <protocol type="pbcast.STABLE"/>
                <protocol type="pbcast.GMS"/>
                <protocol type="UFC"/>
                <protocol type="MFC"/>
                <protocol type="FRAG2"/>
                <protocol type="RSVP"/>
            </stack>
        </subsystem>
...
        <subsystem xmlns="urn:jboss:domain:web:1.4">
            ...
            <sso reauthenticate="false" cache-container="web" cache-name="sso" />
            ...
        </subsystem>
{code}

and persistence.xml :
{code:xml}
...
      <shared-cache-mode>ENABLE_SELECTIVE</shared-cache-mode>
      <properties>
         <property name="hibernate.cache.use_second_level_cache" value="true" />
...
{code}

I took all the configuration from the default standalone-full-ha.xml and I would have it expect to works out of the box.

I used a lot Infinispan outside many J2EE environment and, to me, transport should not be defined inside a cache container but at the same level ; cache container should refer to it.

Here is my proposal :
{code:xml}
        <subsystem xmlns="urn:jboss:domain:infinispan:1.4">
            <transport name="default" lock-timeout="60000"/>
            <cache-container name="web" aliases="standard-session-cache" default-cache="local-web" module="org.jboss.as.clustering.web.infinispan">
                <transport name="default"/>
                <local-cache name="local-web" batching="true">
                    <file-store passivation="false" purge="false"/>
                </local-cache>
                <replicated-cache name="sso" mode="SYNC" batching="true"/>
            </cache-container>
            <cache-container name="hibernate" default-cache="local-query" module="org.jboss.as.jpa.hibernate:4">
                <transport name="default"/>
                <local-cache name="local-query">
                    <transaction mode="NONE"/>
                    <eviction strategy="LIRS" max-entries="10000"/>
                    <expiration max-idle="100000"/>
                </local-cache>
                <invalidation-cache name="entity" mode="SYNC">
                    <transaction mode="NON_XA"/>
                    <eviction strategy="LIRS" max-entries="10000"/>
                    <expiration max-idle="100000"/>
                </invalidation-cache>
                <replicated-cache name="timestamps" mode="ASYNC">
                    <transaction mode="NONE"/>
                    <eviction strategy="NONE"/>
                </replicated-cache>
            </cache-container>
        </subsystem>
{code}

For now, I can workaround the problem by using a different jgroups stack. Though this is definitely not an elegant solution.


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


More information about the jboss-jira mailing list