Java heap space issue

Hi,
I’m running a tomcat server on windows, and I keep getting this exception every hour almost.
the service stops responding after it and I have to restart the service for it to run again.

I have updated the setenv.bat file to have “set CATALINA_OPTS=-Xmx8192m” but no luck.
Any idea how to solve this issue ?

Thanks,

WARNING [http-nio-80-exec-15] org.camunda.commons.logging.BaseLogger.logWarn ENGINE-REST-HTTP500 java.lang.OutOfMemoryError: Java heap space
at com.microsoft.sqlserver.jdbc.SimpleInputStream.getBytes(SimpleInputStream.java:347)
at com.microsoft.sqlserver.jdbc.SQLServerBlob.getBytesFromStream(SQLServerBlob.java:248)
at com.microsoft.sqlserver.jdbc.SQLServerBlob.fillFromStream(SQLServerBlob.java:231)
at com.microsoft.sqlserver.jdbc.SQLServerResultSet.fillLOBs(SQLServerResultSet.java:5576)
at com.microsoft.sqlserver.jdbc.SQLServerResultSet.discardFetchBuffer(SQLServerResultSet.java:5601)
at com.microsoft.sqlserver.jdbc.SQLServerResultSet.closeInternal(SQLServerResultSet.java:616)
at com.microsoft.sqlserver.jdbc.SQLServerResultSet.close(SQLServerResultSet.java:634)
at jdk.internal.reflect.GeneratedMethodAccessor40.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:564)
at org.apache.ibatis.logging.jdbc.ResultSetLogger.invoke(ResultSetLogger.java:69)
at com.sun.proxy.$Proxy7.close(Unknown Source)
at org.apache.ibatis.executor.resultset.DefaultResultSetHandler.closeResultSet(DefaultResultSetHandler.java:276)
at org.apache.ibatis.executor.resultset.DefaultResultSetHandler.handleResultSet(DefaultResultSetHandler.java:309)
at org.apache.ibatis.executor.resultset.DefaultResultSetHandler.handleResultSets(DefaultResultSetHandler.java:194)
at org.apache.ibatis.executor.statement.PreparedStatementHandler.query(PreparedStatementHandler.java:65)
at org.apache.ibatis.executor.statement.RoutingStatementHandler.query(RoutingStatementHandler.java:79)
at org.apache.ibatis.executor.BatchExecutor.doQuery(BatchExecutor.java:92)
at org.apache.ibatis.executor.BaseExecutor.queryFromDatabase(BaseExecutor.java:324)
at org.apache.ibatis.executor.BaseExecutor.query(BaseExecutor.java:156)
at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:109)
at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:83)
at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:147)
at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:140)
at org.apache.ibatis.session.defaults.DefaultSqlSession.selectOne(DefaultSqlSession.java:76)
at org.camunda.bpm.engine.impl.db.sql.DbSqlSession.selectById(DbSqlSession.java:110)
at org.camunda.bpm.engine.impl.db.entitymanager.DbEntityManager.selectById(DbEntityManager.java:210)
at org.camunda.bpm.engine.impl.persistence.entity.util.ByteArrayField.getByteArrayEntity(ByteArrayField.java:84)
at org.camunda.bpm.engine.impl.persistence.entity.util.ByteArrayField.deleteByteArrayValue(ByteArrayField.java:130)
at org.camunda.bpm.engine.impl.persistence.entity.VariableInstanceEntity.deleteByteArrayValue(VariableInstanceEntity.java:262)
at org.camunda.bpm.engine.impl.persistence.entity.VariableInstanceEntity.clearValueFields(VariableInstanceEntity.java:294)
at org.camunda.bpm.engine.impl.persistence.entity.VariableInstanceEntity.delete(VariableInstanceEntity.java:158)

HI @Aghyad ,

Change like below

CATALINA_OPTS="-Xmx2048m -XX:MaxPermSize=1024m -XX:PermSize=1024m

Regards,