Apache Ignite cache freeze after a period of time - caching

I have a cluster of 6 server and 1 client nodes. My client node does a lot of update and create jobs and there is also an expiry policy in order to catch the expired items.
But every day, the cluster freezes at least once. Even ignitevisor's cache command freeze during the call.
So I have looked at thread dump and I saw a strange thing that , there a a lot of same statements like this:
"pub-#39%null%" #51 prio=5 os_prio=0 tid=0x00007f9788623800 nid=0x1d02 waiting on condition [0x00007f9769ddc000]
java.lang.Thread.State: WAITING (parking)
at sun.misc.Unsafe.park(Native Method)
- parking to wait for <0x00000006c004aaa8> (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject)
So there are plenty of threads waiting for a condition but somehow it never happens.
My cache config is like:
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd">
<!--
Alter configuration below as needed.
-->
<bean id="grid.cfg" class="org.apache.ignite.configuration.IgniteConfiguration">
<!-- Configure internal thread pool. -->
<property name="publicThreadPoolSize" value="64"/>
<!-- Configure system thread pool. -->
<property name="systemThreadPoolSize" value="32"/>
<property name="discoverySpi">
<bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
<property name="ipFinder">
<bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder">
<property name="addresses">
<list>
...
</list>
</property>
</bean>
</property>
</bean>
</property>
<property name="cacheConfiguration">
<list>
<bean class="org.apache.ignite.configuration.CacheConfiguration">
<property name="name" value="asd1"/>
<property name="eagerTtl" value="true"/>
<property name="expiryPolicyFactory">
<bean class="javax.cache.configuration.FactoryBuilder.SingletonFactory">
<constructor-arg name="instance">
<bean class="javax.cache.expiry.TouchedExpiryPolicy">
<constructor-arg name="expiryDuration">
<bean class="javax.cache.expiry.Duration">
<constructor-arg name="timeUnit">
<value type="java.util.concurrent.TimeUnit">MILLISECONDS</value>
</constructor-arg>
<constructor-arg name="durationAmount" value="10800000"/>
</bean>
</constructor-arg>
</bean>
</constructor-arg>
</bean>
</property>
</bean>
<bean class="org.apache.ignite.configuration.CacheConfiguration">
<property name="name" value="asd2"/>
<property name="eagerTtl" value="true"/>
<property name="expiryPolicyFactory">
<bean class="javax.cache.configuration.FactoryBuilder.SingletonFactory">
<constructor-arg name="instance">
<bean class="javax.cache.expiry.TouchedExpiryPolicy">
<constructor-arg name="expiryDuration">
<bean class="javax.cache.expiry.Duration">
<constructor-arg name="timeUnit">
<value type="java.util.concurrent.TimeUnit">MILLISECONDS</value>
</constructor-arg>
<constructor-arg name="durationAmount" value="86400000"/>
</bean>
</constructor-arg>
</bean>
</constructor-arg>
</bean>
</property>
</bean>
</list>
</property>
<property name="includeEventTypes" value="70"/>
</bean>
</beans>
I really need help here. Thx

This was discussed on Apache Ignite forum: http://apache-ignite-users.70518.x6.nabble.com/Apache-Ignite-cluster-freeze-after-a-period-of-time-td7726.html
Most likely the deadlock is caused by reordered keys within a putAll operation.

Related

How to read application.properties file , while starting Ignite from spring config file

I was trying to start a Apache Ignite from spring config xml file. The spring xml has keys that it reads from application.properties file.
I am using the following command to start Apache Ignite
apache-ignite-fabric-2.6.0-bin\bin\ignite.bat D:\workspace\<application-name>\src\main\resources\ignite.xml
I tried setting up a CLASSPATH environment variable where i have kept all the related spring and ignite jars and have also kept the application.properties file. Still its somehow now able to read the apploication.properties file.
Caused by: org.springframework.beans.factory.BeanDefinitionStoreException: Invalid bean definition with name 'ignite.cfg' defined in URL [file:/D:/workspace/<application-name>/src/main/resources/ignite.xml]: No configuration setting found for key 'zookeeper'; nested exception is com.typesafe.config.ConfigException$Missing: No configuration setting found for key 'zookeeper'
at org.springframework.beans.factory.config.PlaceholderConfigurerSupport.doProcessProperties(PlaceholderConfigurerSupport.java:223)
at org.springframework.beans.factory.config.PropertyPlaceholderConfigurer.processProperties(PropertyPlaceholderConfigurer.java:222)
at org.springframework.beans.factory.config.PropertyResourceConfigurer.postProcessBeanFactory(PropertyResourceConfigurer.java:86)
at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:283)
at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:163)
at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:687)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:525)
at org.apache.ignite.internal.util.spring.IgniteSpringHelperImpl.applicationContext(IgniteSpringHelperImpl.java:381)
I have tried setting the classpath as well as tried keeping the file/jar in lib directory of IGNITE_HOME directory.
ignite.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:util="http://www.springframework.org/schema/util"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/util
http://www.springframework.org/schema/util/spring-util.xsd">
<bean id="ignite.cfg" class="org.apache.ignite.configuration.IgniteConfiguration">
<!--<property name="gridLogger">
<bean class="org.apache.ignite.logger.slf4j.Slf4jLogger"/>
</property>-->
<!-- Enabling Apache Ignite native persistence. -->
<property name="peerClassLoadingEnabled" value="false"/>
<property name="dataStorageConfiguration">
<bean class="org.apache.ignite.configuration.DataStorageConfiguration">
<property name="walMode" value="NONE"/>
<property name="walArchivePath" value="D:\work\TIWorkspace\ignite\wal\archive"/>
<property name="defaultDataRegionConfiguration">
<bean class="org.apache.ignite.configuration.DataRegionConfiguration">
<property name="persistenceEnabled" value="true"/>
<!-- Increasing the buffer size to 1 GB. -->
<property name="checkpointPageBufferSize"
value="#{1024L * 1024 * 1024}"/>
</bean>
</property>
</bean>
</property>
<property name="binaryConfiguration">
<bean class="org.apache.ignite.configuration.BinaryConfiguration">
<property name="compactFooter" value="false"/>
<property name="idMapper">
<bean class="org.apache.ignite.binary.BinaryBasicIdMapper">
<property name="lowerCase" value="true"/>
</bean>
</property>
<property name="nameMapper">
<bean class="org.apache.ignite.binary.BinaryBasicNameMapper">
<property name="simpleName" value="true"/>
</bean>
</property>
</bean>
</property>
<property name="discoverySpi">
<bean class="org.apache.ignite.spi.discovery.zk.ZookeeperDiscoverySpi">
<property name="zkConnectionString" value="localhost:2181"/>
<!--<property name="zkConnectionString" value="${zookeeper.server}"/>-->
<property name="zkRootPath" value="/dbobjects"/>
</bean>
</property>
</bean>
<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="location">
<value>classpath:application.properties</value>
</property>
</bean>
Any leads could be helpful.
Thanks in advance.
The most straightforward way to achieve that is to use file-based resource URL. This one worked for me:
<bean id="placeholderConfig" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<list>
<value>file:${IGNITE_HOME}/libs/application.properties</value>
</list>
</property>
</bean>

Weblogic Deployment Unable to Resolve Local Queue

We have a spring-based application that is failing to deploy on a Weblogic 10.3 container. Upon deployment, the application attempts to look up two local JMS queues within the Weblogic container's JMS module and, when the deployment takes place, the application locates one local queue okay but not the other.
Both queues are configured exactly the same except for their names are different. Why does the application locate one queue okay but not the other???
I've checked queue names JNDI names many times over and I can't see any spelling errors or anything like that.
I have turned trace logging on and I can see that the connection factory used to look up both queues is the same, the spring JMS configuration is exactly the same for both queues yet one it finds the other it does not.
I don't know what else to check to establish what the problem might be... any ideas?
This is the error I get when it fails to look up one of the queues in the Weblogic JNDI tree:
Caused by: javax.naming.NameNotFoundException: Unable to resolve 'QUEUE_NAME'. Resolved ''; remaining name 'QUEUE_NAME'
at weblogic.jndi.internal.BasicNamingNode.newNameNotFoundException(BasicNamingNode.java:1139)
PS: Both queues have the same Subdeployment and same Targets configured.
---- edited to add artifact's Spring XML Configuration snippet below ----
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
xmlns:tx="http://www.springframework.org/schema/tx" xmlns:security="http://www.springframework.org/schema/security"
xmlns:lang="http://www.springframework.org/schema/lang"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/security
http://www.springframework.org/schema/security/spring-security-3.0.xsd
http://www.springframework.org/schema/lang
http://www.springframework.org/schema/lang/spring-lang-3.0.xsd">
<context:component-scan base-package="com.company.service" />
<bean id="jndiTemplate" class="org.springframework.jndi.JndiTemplate">
<property name="environment">
<props>
<prop key="java.naming.factory.initial">weblogic.jndi.WLInitialContextFactory</prop>
</props>
</property>
</bean>
<!-- this is the Message Driven POJO (MDP) -->
<bean id="messageListener" class="com.company.service.controller.ServiceJMSListener" />
<!-- this is the message listener container -->
<bean id="jmsContainer"
class="org.springframework.jms.listener.DefaultMessageListenerContainer">
<property name="connectionFactory" ref="queueConnectionFactory" />
<property name="destination" ref="inboundQueue" />
<property name="messageListener" ref="messageListener" />
<property name="concurrentConsumers" value="1" />
</bean>
<!-- JNDI Connection Factory -->
<bean id="queueConnectionFactory" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiTemplate">
<ref bean="jndiTemplate" />
</property>
<property name="jndiName">
<value>SERVICE_QCF</value>
</property>
</bean>
<!-- Queue to listen to -->
<bean id="inboundQueue" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiTemplate">
<ref bean="jndiTemplate" />
</property>
<property name="jndiName">
<value>QUEUE_A</value>
</property>
</bean>
<bean id="outboundQueue" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiTemplate">
<ref bean="jndiTemplate" />
</property>
<property name="jndiName">
<value>QUEUE_B</value>
</property>
</bean>
<bean id="queueTemplate" class="org.springframework.jms.core.JmsTemplate">
<property name="connectionFactory">
<ref bean="queueConnectionFactory" />
</property>
<property name="destinationResolver">
<ref bean="jmsDestinationResolver" />
</property>
</bean>
<bean id="jmsDestinationResolver"
class="org.springframework.jms.support.destination.JndiDestinationResolver">
<property name="jndiTemplate">
<ref bean="jndiTemplate" />
</property>
<property name="cache">
<value>true</value>
</property>
</bean>
</beans>
Can you have a look to the JDNI tree in your running server to check if the queue is created or not, and to which jndi name it is bound to ? Use the admin console for this purpose.

Spring Batch - Load properties from database table

I have a requirement in my spring batch where I have to load few key value properties from a database table. Is this possible? The job runs in a stand alone environment and not in a container.
Please let me know if you have a solution for this. `I am in a secured environment and that is the reason I have not shared the code initially. Anyways below is what I have. Below are my properties
<bean id="properties"
class="org.springframework.beans.factory.config.PropertiesFactoryBean">
<property name="locations">
<list>
<value>classpath:EnvConfig.properties</value>
<value>classpath:DatabaseConfig.properties</value>
<value>classpath:WebServiceConfig.properties</value>
</list>
</property>
</bean>
<bean id="propertyPlaceholderConfigurer"
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="properties" ref="properties" />
</bean>
<bean
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="properties">
<bean class="org.apache.commons.configuration.ConfigurationConverter"
factory-method="getProperties">
<constructor-arg>
<bean class="org.apache.commons.configuration.DatabaseConfiguration">
<constructor-arg>
<ref bean="sam-datasource" />
</constructor-arg>
<constructor-arg value="PTTMCDB.PROPERTY" /> <!-- DB Table -->
<constructor-arg value="PROPERTYNAME" /> <!-- DB Key Column -->
<constructor-arg value="PROPERTYVALUE" /> <!-- DB Value Column -->
</bean>
</constructor-arg>
</bean>
</property>
</bean>
This is where I am reading the properties fetched from DB.
<bean id="emailReaderUtil"
class="mailreader.pop3.EmailReaderUtil">
<property name="popServerHost" value="${pop3.popServerHost}"/>
</bean>

Spring: JMSTemplate/CachingConnectionFactory deployables unable to start automatically in weblogic

I recently changed some of my application to use the the following:
org.springframework.jndi.JndiTemplate
org.springframework.jms.connection.CachingConnectionFactory
org.springframework.jms.core.JmsTemplate
Everything is working fine and I'm able to deploy my war files and send JMS messages to the queue.
However something peculiar happens when my managed server restarts. The deployables will all go into a fail state which requires me to then manually start them up.
This started happening after the change to use caching connection factory, jndi template and jms template.
My SpringConfig file:
<!-- Service Controller begin -->
<bean id="appUtils" class="com.foo.util.AppUtil" lazy-init="true" />
<bean id="jms_jndiTemplate" class="org.springframework.jndi.JndiTemplate" lazy-init="true">
<property name="environment">
<props>
<prop key="java.naming.factory.initial">#{jmsJndiFactory}</prop>
<prop key="java.naming.provider.url">#{jmsIp}</prop>
</props>
</property>
</bean>
<bean id="jmsUtils" class="com.foo.JmsUtil" >
<property name="template">
<bean class="org.springframework.jms.core.JmsTemplate" lazy-init="true">
<property name="connectionFactory">
<bean class="org.springframework.jms.connection.CachingConnectionFactory" lazy-init="true">
<property name="sessionCacheSize" value="10" />
<property name="targetConnectionFactory">
<bean class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiTemplate" ref="jms_jndiTemplate" />
<property name="jndiName" ref="jmsFactory" />
</bean>
</property>
</bean>
</property>
</bean>
</property>
<property name="destination">
<bean class="org.springframework.jndi.JndiObjectFactoryBean" lazy-init="true">
<property name="jndiTemplate" ref="jms_jndiTemplate" />
<property name="jndiName" ref="jmsQueue" />
</bean>
</property>
</bean>
ApplicationContext file:
<bean id="jmsQueue" class="java.lang.String" ><constructor-arg value="${jmsQueue.local}" /></bean>
<bean id="jmsFactory" class="java.lang.String" ><constructor-arg value="${jmsFactory.local}" /></bean>
<bean id="jmsJndiFactory" class="java.lang.String" ><constructor-arg value="${jmsJndiFactory.local}" /></bean>
<bean id="jmsIp" class="java.lang.String" ><constructor-arg value="${jmsIp.local}" /></bean>
applicationProperties file:
jmsQueue.local=jms/Queue
jmsFactory.local=jms/ConnectionFactory
jmsJndiFactory.local=weblogic.jndi.WLInitialContextFactory
jmsIp.local=t3://localhost:7031
Anyone has any idea as to why this might be happening? I'm using Weblogic. Any help would be greatly appreciated.
Thanks!
Edit: Forgot to mention that the error causing the failed state is
javax.naming.NameNotFoundException: Unable to resolve 'jms.Queue'. Resolved 'jms'; remaining name 'Queue'.
This is a JNDI error. The message means "I tried to find jms/Queue in the JNDI context but I only got as far as jms; there is no Queue child below".
Check the resources which you configured for the application in WebSphere.

quartz jobs in a cluster running on wrong node

uI have an application that is clustered in a 2+2 setup where 2 machines are used in alpha product phase, and the other two are used for real customers. all machines are looking at the same database,
I need a job to run at midnight for each of the groups. one of the two alpha machines should get a job, and the other two should get another job.
I'm using Spring 3.0.5 with Quartz 1.8.5 with the following properties
phase=alpha
quartz.job.name=MY_JOB_${phase}
<bean id="quartzPropertiesFactoryBean" class="com.liveperson.kwo.quartz.QuartzPropertiesFactory">
<constructor-arg value="AUTO"/>
<constructor-arg value="MY_CLUSTER"/>
<constructor-arg value="JobStoreTX"/>
<constructor-arg value="StdJDBCDelegate"/>
<constructor-arg value="true"/> //isClustered
<constructor-arg value="false"/> //useProperties
</bean>
<bean name="runJobBean" class="org.quartz.JobDetail">
<property name="name" value="${quartz.job.name}"/>
<property name="jobClass" value="CLASS1"/>
<property name="group" value="JOB-for-${quartz.job.name}"/>
<property name="jobDataMap">
<bean class="org.quartz.JobDataMap">
</bean>
</property>
</bean>
<bean name="schedulerFactoryBean" class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
<property name="quartzProperties" ref="quartzPropertiesFactoryBean"/>
<property name="dataSource" ref="mySqlConnectorBean"/>
<property name="overwriteExistingJobs" value="true"/>
<property name="jobDetails">
<list>
<ref bean="runJobBean"/>
</list>
</property>
<property name="triggers">
<list>
<ref bean="cronTriggerBean"/>
</list>
</property>
</bean>
I define two jobs, one for alpha and another for production throw the phase property, and the problem I'm having is that the job I define for alpha phase runs on the node defined to production, how can I make the job defined for the alpha phase run only on machines defined for alpha?
Thanks!

Resources