This article outlines the steps needed to increase the Java heap space to avoid out-of-memory exceptions in the driver. Such exceptions can occur, for example, when loading a large recipe.
When working with large datasets or complex operations in Java applications, you might encounter out-of-memory exceptions. These exceptions typically occur when the Java Virtual Machine (JVM) cannot allocate enough memory for objects, leading to application crashes or unresponsive behavior.
Symptoms of an out-of-memory exception can include:
In the driver log, the exception might appear as follows:
2024-06-26 15:33:34.924 ERROR [c.m.v.d.b.drivers.kns.ws.AsmbServiceSoapImpl <BaseDriverScheduler-2> ] Fail to prepare SOAP message for logging. Continue handling without logging.
com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl: Error during saving a multipart message
at com.sun.xml.internal.messaging.saaj.soap.MessageImpl.saveChanges(Unknown Source)
at com.sun.xml.internal.messaging.saaj.soap.MessageImpl.writeTo(Unknown Source)
at com.mentor.valor.da.blackbox.drivers.kns.ws.AsmbServiceSoapImpl.printRawMessage(AsmbServiceSoapImpl.java:89)
at com.mentor.valor.da.blackbox.drivers.kns.ws.AsmbServiceSoapImpl.getData(AsmbServiceSoapImpl.java:231)
at com.mentor.valor.da.blackbox.drivers.kns.ws.CamxReceiver.pollData(CamxReceiver.java:158)
at sun.reflect.GeneratedMethodAccessor76.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.springframework.scheduling.support.ScheduledMethodRunnable.run(ScheduledMethodRunnable.java:84)
at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:54)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask.runAndReset(Unknown Source)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(Unknown Source)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.OutOfMemoryError: Java heap space
To resolve the out-of-memory exception, you need to increase the Java heap space. Follow these steps:
The driver should automatically restart. If it didn’t – restart it from MSS WS.
Verify that the change took place:
Open the driver log and find at the beginning of the log the raw that starts with: JVM arguments:
It should contain the new values for -Xms & -Xmx