Error Java Heap Size(maxmemory set at 16gb)

Hello, I’ve been having this error for sometime now when i open one of my windows. i will try to be as detailed as possible so please read on. and thanks in advance

I press a push button to open a new window should open. using following script, to pass two values to the new window.

  param1 = event.source.parent.getComponent('Power Table 1').runid
     param2 = event.source.parent.getComponent('Power Table 1').lineid
     linea=event.source.parent.getComponent('Power Table 1').linename

     if param1 == 0 : 
         system.gui.messageBox ("PLEASE SELECT A RUN FROM THE TABLE")
    else:
         if system.gui.confirm(u'ESTA ACCION VA A PRODUCIR PALLETS EN LA LINEA %s , DESEA CONTINUAR?' % linea, 'Confirm'):

              window = system.nav.swapTo('ProductionPallets/CreatePallettouch110118', {'runid' : param1 ,'lineid' : param2})
		      system.nav.centerWindow(window)

But it does not always work correctly, instead i get these 3 different scenarios scenarios are happening:

1- windows open correctly.
2- windows does not open at all, the client freezes for about 3-4 seconds, and then logs this error.


>Writing project to cache file C:\Users\Juan\.ignition\cache\gwxxx.xxx.xxx.xxx_xxxx_xxxx_main\C0\CSJasmine.proj
Exception in thread "AWT-EventQueue-2" java.lang.OutOfMemoryError: Java heap space
	at java.lang.StringCoding$StringDecoder.decode(Unknown Source)
	at java.lang.StringCoding.decode(Unknown Source)
	at java.lang.StringCoding.decode(Unknown Source)
	at java.lang.String.<init>(Unknown Source)
	at java.io.ByteArrayOutputStream.toString(Unknown Source)
	at org.python.core.Py.getStackTrace(Py.java:980)
	at org.python.core.Py.displayException(Py.java:1106)
	at org.python.core.PyException.printStackTrace(PyException.java:79)
	at org.python.core.PyException.toString(PyException.java:98)
	at java.lang.Throwable.<init>(Unknown Source)
	at java.lang.Exception.<init>(Unknown Source)
	at com.inductiveautomation.ignition.common.script.JythonExecException.<init>(JythonExecException.java:21)
	at com.inductiveautomation.ignition.common.script.ScriptManager.runCode(ScriptManager.java:639)
	at com.inductiveautomation.factorypmi.application.binding.action.ActionAdapter.runActions(ActionAdapter.java:180)
	at com.inductiveautomation.factorypmi.application.binding.action.ActionAdapter.invoke(ActionAdapter.java:271)
	at com.inductiveautomation.factorypmi.application.binding.action.RelayInvocationHandler.invoke(RelayInvocationHandler.java:57)
	at com.sun.proxy.$Proxy20.actionPerformed(Unknown Source)
	at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
	at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
	at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
	at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
	at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
	at java.awt.Component.processMouseEvent(Unknown Source)
	at javax.swing.JComponent.processMouseEvent(Unknown Source)
	at java.awt.Component.processEvent(Unknown Source)
	at java.awt.Container.processEvent(Unknown Source)
	at java.awt.Component.dispatchEventImpl(Unknown Source)
	at java.awt.Container.dispatchEventImpl(Unknown Source)
	at java.awt.Component.dispatchEvent(Unknown Source)
	at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
	at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
	at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)

3 - I press button once more, after the Error in the other scenario shown above and the windows opens, but the following happens:

    1. It opens on the background(and layer index of that window is highest in client so it should never be in behind any window)
    2. the data on the window it's grey out, like on the image below. 

    3. There is no data being polled from the DB 
    4. The PowerTable Background color is supposed to be  Alternating White/Gray  but as shown all Gray. 
    5. Component next to label "SKU"  its supposed to show the selected value based on the Run ID: component above.

When the heap size error doesn’t occur the window works just fine. it has actually been working for a while with less occurrence until yesterday.

About this window and hardware information in case it’s related to the error:

   * It has multiple property bindings with sql. query set at Poll Rate Off, but they all execute when windows opens first time. (10 properties are bound like that) So running at least 10 Queries when window opens.
   * Pass in two properties as shown in script above from previous window.
   * Windows has 23 expressions bindings .
   * 3 Expression bindings have now(0) in them for different calculation. 
   * When window opens no other error in the log.
   * Client Memory 1gb, ( i can increase to more if needed)
   * Workstations running the Client in Windows, all have from 8GB  RAM and up to 16GB
   * Gateway in Server 2016, 64GB ram.  Ignition wrapper conf. set as below.

# Wrapper Java Properties
#********************************************************************
# Java Application
#  Locate the java binary on the system PATH:
wrapper.java.command=C:\Program Files\Java\jdk-10.0.1\bin\java.exe
#  Specify a specific java binary:
#set.JAVA_HOME=/java/path
#wrapper.java.command=C:\Program Files\Java\jdk-10.0.1\bin\java.exe

# Tell the Wrapper to log the full generated Java command line.
#wrapper.java.command.loglevel=INFO

# Java Main class.  This class must implement the WrapperListener interface
#  or guarantee that the WrapperManager class is initialized.  Helper
#  classes are provided to do this for you.  See the Integration section
#  of the documentation for details.
wrapper.java.mainclass=org.tanukisoftware.wrapper.WrapperSimpleApp

# Java Classpath (include wrapper.jar)  Add class path elements as
#  needed starting from 1
wrapper.java.classpath.1=lib/wrapper.jar
wrapper.java.classpath.2=lib/catapult.jar

# Java Library Path (location of Wrapper.DLL or libwrapper.so)
wrapper.java.library.path.1=lib

# Java Bits.  On applicable platforms, tells the JVM to run in 32 or 64-bit mode.
wrapper.java.additional.auto_bits=TRUE

# Java Additional Parameters
wrapper.java.additional.1=-XX:PermSize=64m
wrapper.java.additional.2=-XX:MaxPermSize=128m
#wrapper.java.additional.3=-XX:+UseConcMarkSweepGC
wrapper.java.additional.4=-XX:+CMSClassUnloadingEnabled
#wrapper.java.additional.5=-XX:+CMSPermGenSweepingEnabled
wrapper.java.additional.6=-Ddata.dir=data
wrapper.java.additional.7=-Dorg.apache.catalina.loader.WebappClassLoader.ENABLE_CLEAR_REFERENCES=false
#wrapper.java.additional.8=-Xdebug
#wrapper.java.additional.9=-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8000

# Initial Java Heap Size (in MB)
wrapper.java.initmemory=4096

# Maximum Java Heap Size (in MB)
wrapper.java.maxmemory=16384

# Application parameters.  Add parameters as needed starting from 1
wrapper.app.parameter.1=com.inductiveautomation.catapult.Catapult

wrapper.shutdown.timeout=120
wrapper.jvm_exit.timeout=120

# Set this value to TRUE to allow ignition.conf to be reloaded when the JVM is restarted
wrapper.restart.reload_configuration=TRUE

Again thanks for the help.

The memory settings shown are for the gateway. You are running out of memory in the client. What are the client memory settings in the project properties? What does the memory usage graph look like in the client diagnostics windows?

Thanks for the quick response, like i mention please read on information it’s there.

image

Client Memory set at 1GB.

Graph

image

client in this workstation it’s in STAGING and has been update multiple times since last open.

clients on the other works stations, memeory usage it’s much less. Project Name : Jasmine

any other details let me know.

It’s not clear why that project uses so much more memory that the others, but it is. Based on the graph, it is occasionally hitting 1GB and therefore dying. Increase the client memory allotment.

Also consider adding the following to your native client launcher’s command line for this (or all) of your projects:

 jvm-args="-XX:+UseG1GC"
1 Like

i’ll try but i have been doing thins since 256MB increasing and not been solved.

and what does the code you provided do ? and where would it put it?

It switches the garbage collector to a better algorithm. It uses a bit more CPU time, but keeps memory usage lower, usually. The graph of memory usage, over a long enough time period, shows a steady increase until it approaches maximum, then a cleanup is done, and the graph starts climbing again. G1GC makes this happen faster, and cleans up more reliably. I've found that everything runs most efficiently if the trough of the graph is <50% of max, and the peak of the graph is <80% of max.

You put that setting on the command line in your desktop shortcut for the project, as created by the native client launcher for your platform.

1 Like