Hi Isomorphic Team,
We are facing an issue in our application where it runs Out Of Memory over time!
This application has 2 parts - Webapp and an Offline Batch (and both are running into same issue! I'll describe the issue with the batch).
The Offline Batch runs independently, wherein it does a 'SELECT' from DB every N minutes, and then does some operations with the fetched data.
Once in a while, it executes Insert/Update/Delete as well.
Below is a sample program that I created which reproduces the same problem!
The issue happens when we call the dsRequest.execute() method!
My guess is that we are not freeing some of the connection resources explictly. However, I tried calling 'freeResources()', or even using 'setFreeOnExecute(true)', but I do not see any difference!
My ds file is a simple Select query.
I am also attaching a few screenshots that I captured with JProfiler.
With the tool, I have noticed that the major memory consumer is the method 'DriveManager.getConnection()' and the types are byte[] and char[]! These seem to continuously increase over time, until if finally crashes the JVM!
P.S:
Reproduction Env.
Java 7u45
Isomorphic Jars - 4.1.1
IntelliJ IDEA 15.0.x
IntelliJ VM Options:
-ea -DwebRoot="C:\mi\Simple_Batch\target\classes" -DdsRoot="C:\mi\Simple_Batch\target\classes\ds" -Dmilogdir="C:\mi\Simple_Batch\logs" -Xmx1024m
We are facing an issue in our application where it runs Out Of Memory over time!
This application has 2 parts - Webapp and an Offline Batch (and both are running into same issue! I'll describe the issue with the batch).
The Offline Batch runs independently, wherein it does a 'SELECT' from DB every N minutes, and then does some operations with the fetched data.
Once in a while, it executes Insert/Update/Delete as well.
Below is a sample program that I created which reproduces the same problem!
Code:
import com.isomorphic.base.Config;
import com.isomorphic.base.ISCInit;
import com.isomorphic.datasource.DSRequest;
import org.apache.log4j.Logger;
import java.util.List;
import java.util.Map;
public class BatchRunner
{
private static Logger logger = Logger.getLogger(BatchRunner.class);
private static final String DS_INTEGRATION_TEST = "integrationTests";
private static final String OP_READ_SINGLE_TEST = "readSingleTestInfo";
private static final String FETCH_OPERATION = "fetch";
private static final String DB_URL = "jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=xe)))";
private static final String DB_CRED = "CMXADMIN";
public static void main (String[] args)
{
try
{
init();
while ( true )
{
run();
}
}
catch (Exception e)
{
logger.error(e.getMessage(), e);
}
}
private static void init () throws Exception
{
try {
ISCInit.go();
Config.initGlobalConfig();
Config.getGlobal().put("sql.Oracle.driver.url", DB_URL);
Config.getGlobal().put("sql.Oracle.driver.user", DB_CRED);
Config.getGlobal().put("sql.Oracle.driver.password", DB_CRED);
Config.getGlobal().put("webRoot", System.getProperty("webRoot"));
} catch (Exception e) {
logger.error(e.getMessage(), e);
throw new Exception("Failed to load the application", e);
}
}
private static void run ()
{
try {
DSRequest dsRequest = new DSRequest();
dsRequest.setDataSourceName(DS_INTEGRATION_TEST);
dsRequest.setOperationType(FETCH_OPERATION);
dsRequest.setOperationId(OP_READ_SINGLE_TEST);
List record = dsRequest.execute().getDataList();
log(record);
// log(dsRequest.execute().getDataList());
} catch (Exception e) {
e.printStackTrace();
}
}
// DUMMY METHOD
private static void log (List<Map<String, Object>> alertRecord)
{
logger.info("\n----------------------------------------------------\n");
Map map = (Map) alertRecord.get(0);
// DO SOMETHING NON-FANCY
for (Object object : map.keySet())
{
logger.info(map.get(object));
}
logger.info("\n----------------------------------------------------\n");
}
}
My guess is that we are not freeing some of the connection resources explictly. However, I tried calling 'freeResources()', or even using 'setFreeOnExecute(true)', but I do not see any difference!
My ds file is a simple Select query.
Code:
<DataSource
ID="integrationTests"
serverType="sql"
tableName="DATABASECHANGELOG"
dbName="Oracle">
<fields>
<field name="ID" type="text" title="Liquibase ID"/>
<field name="AUTHOR" type="text" title="Author ID"/>
<field name="FILENAME" type="text" title="FileName"/>
<field name="CMAX_ORDEREXECUTED" type="text" title="Execution Order" nativeName="CMAX_ORDEREXECUTED"/>
</fields>
<operationBindings>
<operationBinding operationType="fetch" operationId="readSingleTestInfo">
<selectClause>
ID, AUTHOR, FILENAME, CMAX_ORDEREXECUTED
</selectClause>
</operationBinding>
</operationBindings>
</DataSource>
With the tool, I have noticed that the major memory consumer is the method 'DriveManager.getConnection()' and the types are byte[] and char[]! These seem to continuously increase over time, until if finally crashes the JVM!
P.S:
Reproduction Env.
Java 7u45
Isomorphic Jars - 4.1.1
IntelliJ IDEA 15.0.x
IntelliJ VM Options:
-ea -DwebRoot="C:\mi\Simple_Batch\target\classes" -DdsRoot="C:\mi\Simple_Batch\target\classes\ds" -Dmilogdir="C:\mi\Simple_Batch\logs" -Xmx1024m
Comment