Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.

How to change java.io.tmpdir in system properties

Avatar

Level 4

Hello Everypne,

In order to change the java.io.tmpdir to 'C:\Adobe\AEM\Author\cq-temp', I changed like the below that  in C:\Adobe\AEM\Author\crx-quickstart\bin\start.bat

::* -------------------

::* Default JVM options

::* -------------------

set CQ_JVM_OPTS=-server

set CQ_JVM_OPTS=%CQ_JVM_OPTS% -Djava.awt.headless=true

set CQ_JVM_OPTS=%CQ_JVM_OPTS% -Xms8192m

set CQ_JVM_OPTS=%CQ_JVM_OPTS% -Xmx8192m

set CQ_JVM_OPTS=%CQ_JVM_OPTS% -XX:MaxMetaspaceSize=512m

set CQ_JVM_OPTS=%CQ_JVM_OPTS% -XX:NewRatio=1

set CQ_JVM_OPTS=%CQ_JVM_OPTS% -XX:MaxTenuringThreshold=15

set CQ_JVM_OPTS=%CQ_JVM_OPTS% -XX:+UseConcMarkSweepGC

set CQ_JVM_OPTS=%CQ_JVM_OPTS% -XX:ConcGCThreads=4

set CQ_JVM_OPTS=%CQ_JVM_OPTS% -XX:ParallelGCThreads=4

set CQ_JVM_OPTS=%CQ_JVM_OPTS% -Djava.io.tmpdir=C:\Adobe\AEM\Author\cq-temp

set CQ_JVM_OPTS=%CQ_JVM_OPTS% -XX:+HeapDumpOnOutOfMemoryError

set CQ_JVM_OPTS=%CQ_JVM_OPTS% -XX:HeapDumpPath=C:\Adobe\AEM\Author\cq-temp

set CQ_JVM_OPTS=%CQ_JVM_OPTS% -Doak.queryLimitInMemory=500000

set CQ_JVM_OPTS=%CQ_JVM_OPTS% -Doak.queryLimitReads=100000

set CQ_JVM_OPTS=%CQ_JVM_OPTS% -Dupdate.limit=250000

set CQ_JVM_OPTS=%CQ_JVM_OPTS% -Doak.fastQuerySize=true

But it doesn't  change.

1634474_pastedImage_1.png

My environment is the following :

-AEM 6.3

-Windows 10

-Java 1.8.1

Can you help me with mine?

Regards

Chung Yong.

19 Replies

Avatar

Level 4

When I upload the package file, java.lang.OutOfMemoryError : Java heap space happens.

I want to fix java.lang.OutOfMemoryError : Java heap space.

1635057_pastedImage_1.png

1635083_pastedImage_5.png

Avatar

Community Advisor

You may need to increase heap memory

e.g.

-Xmx

The flag Xmx specifies the maximum memory allocation pool for a Java Virtual Machine (JVM), while Xms specifies the initial memory allocation pool. A common use for these flags is when you encounter a java.lang.OutOfMemoryError.

-Xms        set initial Java heap size

-Xmx        set maximum Java heap size

-Xss        set java thread stack size



Arun Patidar

Avatar

Employee Advisor

Have you restarted your instance?

Avatar

Employee Advisor

"GC overhead limit excessed" means that you ran out of heap memory, not disk memory :-)

Avatar

Level 4

I have imported package1.zip successfully in Package Manager.

but we could not import contenct2.zip because of GC overhead limit exceeded

--------------------------------------------

package1.zip       : 20 MB

cotent2.zip          : 723 MB

Here is my JVM options.

set CQ_JVM_OPTS=-server

set CQ_JVM_OPTS=%CQ_JVM_OPTS% -Djava.awt.headless=true

set CQ_JVM_OPTS=%CQ_JVM_OPTS% -XX:NewRatio=1

set CQ_JVM_OPTS=%CQ_JVM_OPTS% -XX:+UseParallelGC

set CQ_JVM_OPTS=%CQ_JVM_OPTS% -XX:+UseParallelOldGC

set CQ_JVM_OPTS=%CQ_JVM_OPTS% -XX:ParallelGCThreads=4

set CQ_JVM_OPTS=%CQ_JVM_OPTS% -Xms8192m

set CQ_JVM_OPTS=%CQ_JVM_OPTS% -Xmx8192m

set CQ_JVM_OPTS=%CQ_JVM_OPTS% -XX:PermSize=256m

set CQ_JVM_OPTS=%CQ_JVM_OPTS% -XX:MaxPermSize=1024m

set CQ_JVM_OPTS=%CQ_JVM_OPTS% -Djava.io.tmpdir=C:\Adobe\AEM\Author\cq-temp

set CQ_JVM_OPTS=%CQ_JVM_OPTS% -XX:+HeapDumpOnOutOfMemoryError

set CQ_JVM_OPTS=%CQ_JVM_OPTS% -XX:HeapDumpPath=C:\Adobe\AEM\Author\cq-temp

set CQ_JVM_OPTS=%CQ_JVM_OPTS% -Djackrabbit.maxQueuedEvents=1000000

My environment is the following :

-AEM 6.3

-Windows 10

-RAM 8 GM.

-Java 1.8.1

Avatar

Level 10

Do you have another instance to test with. As Joerg as pointed out, looks like memory issue with your server.

Avatar

Level 4

My friend has the same environment with me.

-AEM 6.3

-Windows 10

-RAM 8 GM.

-Java 1.8.1

he has the same error(GC overhead limit exceeded)  with me.

Do we have to replace the ram size from 8 G to 16 G in order to fix the memory issue ?

Avatar

Level 10

that would be a good way to start. 8 GB of Ram is not a lot of RAM for an enterprise server. However 8 is within specification of AEM Technical Requirements

Avatar

Employee Advisor

Adding more RAM to the machine itself does not solve the problem in the first place, you need to give the JVM more heap. In my local development environments I always used -Xmx1G and it worked flawlessly.

What kind of package do you install?

Jörg

Avatar

Level 4

This is my CQ_JVM_OPTS.

CQ_JVM_OPTS='-server -Xms4096m -Xmx4096m  -Xss1024k  -XX:MaxPermSize=512m  -XX:-UseGCOverheadLimit -Djava.awt.headless=true -Djava.io.tmpdir=C:\Adobe\AEM\Author\cq-temp'

When I upload cotent2.zip(723 MB) into Package Manager,  GC overhead limit exceeded happens.

This is my system.

1638808_pastedImage_0.png

This is my Task Manager.

1638823_pastedImage_0.png

1638836_pastedImage_1.png

Avatar

Employee Advisor

In case if you are not starting the instance using <crx-quickstart>\bin\start.bat,  please do. It seems you are starting by double-clicking on the jar file.

Thanks

Wasil

Avatar

Level 4

Yes, I was starting by double-clicking on the jar file.

Can you explain how to run start.bat in command.

I referenced the following url.

Command Line Start and Stop

But I can not run start.bat

1638912_pastedImage_1.png

Avatar

Employee Advisor

In Windows explorer, just execute the start.bat by double clicking it. I assume java is set on the path environment variable already[1].

It would launch the AEM instance in new CMD shell as follows :

1638909_pastedImage_1.png

Thanks

Wasil

[1] How to set JAVA_HOME on Windows 10? – Mkyong.com

P.S. : Stop existing running AEM instance to avoid any port conflict while startup.

Avatar

Level 10

Our Cust Care team suggested:

There is a powershell script they can run on their windows environment to capture thread dumps and windows process information (similar to top)

https://github.com/cqsupport/jstackSeries.sh/blob/master/jstackSeries_powershell.ps1

CPU utilization would be high here as GC would be throttling the instance

That -xss JVM flag seems … out of place.  It limits the thread stack to 1 MB which is tiny .

That MaxPermSize flag is also useless if they are on Java8.

Avatar

Level 4

I have already added JAVA_HOME in Environment Varialble for System.

But I can not start start.bat in Windows PowerShell too.

1638928_pastedImage_0.png

This is my start.bat

@echo off

:: This script configures the start information for this server.

::

:: The following variables may be used to override the defaults.

:: For one-time overrides the variable can be set as part of the command-line; e.g.,

::

::     SET CQ_PORT=1234 & ./start.bat

::

setlocal

::* TCP port used for stop and status scripts

if not defined CQ_PORT set CQ_PORT=4502

::* hostname of the interface that this server should listen to

:: if not defined CQ_HOST set CQ_HOST=

::* runmode(s)

::* will not be used if repository is already present

if not defined CQ_RUNMODE set CQ_RUNMODE=author

::* name of the jarfile

:: if not defined CQ_JARFILE set CQ_JARFILE=

::* default JVM options

if not defined CQ_JVM_OPTS set CQ_JVM_OPTS='-server -Xms8192m -Xmx8192m -Xss1024k -XX:MaxPermSize=1024m -XX:-UseGCOverheadLimit -Djava.awt.headless=true -Djava.io.tmpdir=C:\Adobe\AEM\Author\cq-temp'

::* ------------------------------------------------------------------------------

::* authentication

::* ------------------------------------------------------------------------------

::* when using oak (crx3) authentication must be configured using the

::* Apache Felix JAAS Configuration Factory service via the Web Console

::* see http://jackrabbit.apache.org/oak/docs/security/authentication/externalloginmodule.html

::* use jaas.config (legacy: only used for crx2 persistence)

:: if not defined CQ_USE_JAAS set CQ_USE_JAAS=true

::* config for jaas (legacy: only used for crx2 persistence)

if not defined CQ_JAAS_CONFIG set CQ_JAAS_CONFIG=etc\jaas.config

::* ------------------------------------------------------------------------------

::* persistence mode

::* ------------------------------------------------------------------------------

::* the persistence mode can not be switched for an existing repository

set CQ_RUNMODE=%CQ_RUNMODE%,crx3,crx3tar

:: set CQ_RUNMODE=%CQ_RUNMODE%,crx3,crx3mongo

::* settings for mongo db

:: if not defined CQ_MONGO_HOST set CQ_MONGO_HOST=127.0.0.1

:: if not defined CQ_MONGO_PORT set CQ_MONGO_PORT=27017

:: if not defined CQ_MONGO_DB   set CQ_MONGO_DB=aem6

::* ------------------------------------------------------------------------------

::* do not configure below this point

::* ------------------------------------------------------------------------------

chdir /D %~dp0

cd ..

if exist conf\controlport del conf\controlport

if not defined CQ_JARFILE     for %%X in (app\*.jar) do set CQ_JARFILE=%%X

for %%* in (.) do set CurrDirName=%%~n*

cd ..

set START_OPTS=start -c %CurrDirName% -i launchpad

if defined CQ_PORT            set START_OPTS=%START_OPTS% -p %CQ_PORT%

if defined CQ_RUNMODE         set CQ_JVM_OPTS=%CQ_JVM_OPTS% -Dsling.run.modes=%CQ_RUNMODE%

if defined CQ_HOST            set CQ_JVM_OPTS=%CQ_JVM_OPTS% -Dorg.apache.felix.http.host=%CQ_HOST%

if defined CQ_HOST            set START_OPTS=%START_OPTS% -a %CQ_HOST%

if defined CQ_MONGO_HOST      set START_OPTS=%START_OPTS% -Doak.mongo.host=%CQ_MONGO_HOST%

if defined CQ_MONGO_PORT      set START_OPTS=%START_OPTS% -Doak.mongo.port=%CQ_MONGO_PORT%

if defined CQ_MONGO_DB        set START_OPTS=%START_OPTS% -Doak.mongo.db=%CQ_MONGO_DB%

if defined CQ_USE_JAAS        set CQ_JVM_OPTS=%CQ_JVM_OPTS% -Djava.security.auth.login.config=%CQ_JAAS_CONFIG%

set START_OPTS=%START_OPTS% -Dsling.properties=conf/sling.properties

if exist newTaskList.txt del newTaskList.txt

if exist oldTaskList.txt del oldTaskList.txt

tasklist /FI "IMAGENAME eq java.exe" /NH > oldTaskList.txt

start "CQ" cmd.exe /C java %CQ_JVM_OPTS% -jar %CurrDirName%\%CQ_JARFILE% %START_OPTS%

:: removing the delay until CQ-4202186 is solved

:: timeout /T 1 /NOBREAK >nul

tasklist /FI "IMAGENAME eq java.exe" /NH > newTaskList.txt

java -cp %~dp0 GetProcessID oldTaskList.txt newTaskList.txt java.exe > %CurrDirName%\conf\cq.pid

if exist newTaskList.txt del newTaskList.txt

if exist oldTaskList.txt del oldTaskList.txt

Avatar

Level 10

You could be facing a bug of some sort. Customer care and AEM community members have attempted to answer this. If you are still facing issues, i recommend opening a support ticket so our cust care team can investigate this and get to the bottom of what is happening.

Avatar

Level 4

I fixed the error.

CQ_JVM_OPTS In start.bat changed like the below that.

if not defined CQ_JVM_OPTS set CQ_JVM_OPTS=-Xms8192m -Xmx8192m -Xss1024k -XX:MaxPermSize=1024m -XX:-UseGCOverheadLimit -Djava.awt.headless=true -Djava.io.tmpdir=C:\Adobe\AEM\Author\cq-temp

Thank you.