0

There is a directory named /var/xyz/aa/clm/data/infiles/SenderJMS/CE/L3/ where number of XML files are stored after a process runs. These files contain data to be pushed to remote server through a JMS queue. The queue is configured at client's cloud server.

In SenderJMS service code we just use the JMS config credentials and queue name and then start pushing the files. Sometime the XML file list increases to 20K/30K, and in error log we get "OutOfMemoryError". Then the SenderJMS stops in the middle of processing. Then we are restarting the service to process, from where it stopped execution.

Crdentials:

Queue Name: VS.REVFDX.CL10.PUB.LAS.TCF.L3
jndi.environment.property.key.java.naming.provider.url=ldap://apptstldap.corp.<client_name>.com:888/ou=messaging,dc=corp,dc=<client_name>,dc=com
destination.jndiName=fxClientDestinationUID=D.REVFDX.DLRS.ToBeInvoiced

connection.factory.userid= XYZ_UID
connection.factory.password= PWD

JNDI Configuration

@Bean(name = "jndiTemplate")
public JndiTemplate jndiTemplate() {
    JndiTemplate jndiTemplate = new JndiTemplate();
    Properties environment = new Properties();
    environment.setProperty("java.naming.factory.initial", "jndi_environment_property_key_java_naming_factory_initial");
    environment.setProperty("java.naming.provider.url", "jndi_environment_property_key_java_naming_provider_url");
    jndiTemplate.setEnvironment(environment);
    return jndiTemplate;
}

Queue Channel

@Bean(name="channel1")
public QueueChannel queueChannel() {
    return new QueueChannel();
}

File Poller

@Bean(name="fileListPoller1")
public FileListPoller fileListPoller() {
    FileListPoller fp = new FileListPoller();
    fp.setDirectoryPath(file_inbound_dir);
    fp.setExcludes(excludes);
    return fp;
}

Inbound Handler

@Bean(name="inboundHandler2",initMethod="initWS")
public InboundJMSHandlerWS inboundJMSHandlerWS() {
    InboundJMSHandlerWS inboundJMSHandlerWS = new InboundJMSHandlerWS();
    inboundJMSHandlerWS.setChannel(queueChannel());
    inboundJMSHandlerWS.setAddress(inbound_webservice_endpoint_address_4jms);
    return inboundJMSHandlerWS;
}

Outbound Handler

@Bean(name="outboundJMSHandler1",initMethod="initThreadPool")
public OutboundJMSHandler outboundJMSHandler() {
    OutboundJMSHandler outboundJMSHandler = new OutboundJMSHandler();
    outboundJMSHandler.setChannel(queueChannel());
    outboundJMSHandler.setThreadPoolSize(outbound_jmshandler_thread_pool_size);
    outboundJMSHandler.setJndiTemplate(jndiTemplate());
    outboundJMSHandler.setJmsPoolSize(connection_pool_size);
    outboundJMSHandler.setConnectionFactoryJndiKey(connectionFactory_jndiName);
    outboundJMSHandler.setDestinationJndiKey(destination_jndiName);
    outboundJMSHandler.setInterfaceName(outbound_jms_interface_name);
    outboundJMSHandler.setTestLevel(outbound_jms_testLevel);
    outboundJMSHandler.setCnFactoryUID(connection_factory_userid);
    outboundJMSHandler.setCnFactoryPassword(connection_factory_password);
    outboundJMSHandler.setJmsMessageType(jms_message_type);
    return outboundJMSHandler;
}

Error Details:

Exception in thread "TIBCO EMS TCPLink Reader (Server-130801)" java.lang.OutOfMemoryError: Java heap space
Exception in thread "<ClientName>JMSStarvedConsumerTimer" java.lang.OutOfMemoryError: Java heap space.
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=75M; support was removed in 8.0
Java HotSpot(TM) 64-Bit Server VM warning: MaxNewSize (512000k) is equal to or greater than the entire heap (512000k).  A new max generation size of 511936k will be used.

As in the log we got OutOfMemoryError we increased the heap size from 500MB to 1024MB(1GB), but that didn't resolve our issue. Like before, if the above issue come again, we need to restart the SenderJMS service again.

What could be the reason that the SenderJMS application is stopping in between? Do we need to check if the queue is full during file push?

Justin Bertram
  • 29,372
  • 4
  • 21
  • 43

1 Answers1

0

There's no way to know for sure why your application is running out of memory based on the information you've provided. You need to capture a heap dump when you hit the OutOfMemoryError and then analyze it to see what's consuming most of the memory.

To capture a heap dump when you hit the OutOfMemoryError you can use the -XX:+HeapDumpOnOutOfMemoryError JVM parameter as described here.

There are many tools you can use to analyze the heap dump (e.g. JVisualVM, Eclipse MAT, etc.).

Justin Bertram
  • 29,372
  • 4
  • 21
  • 43