EM agent start fails With 'Target Interaction Manager failed at Startup' and 'java.lang.OutOfMemoryError: Java heap space' reported on logs

This post is also available in: Português

In this article, I will show how to solve EM Agent failing to startup related to java memory problems.

Those days, after applying some EM Agent patches and trying to restart them, I received the error below:

[emc12@localhost ~]$ emctl start agent
Oracle Enterprise Manager Cloud Control 12c Release 5
Copyright (c) 1996, 2015 Oracle Corporation.  All rights reserved.
Starting agent ........................................................................... failed.
Fatal agent error: Target Interaction Manager failed at Startup
Fatal agent error: Target Interaction Manager failed at Startup
Fatal agent error: Target Interaction Manager failed at Startup
EMAgent is Thrashing. Exiting watchdog
Consult emctl.log and emagent.nohup in: /u01/app/emc12/agent_inst/sysman/log
[emc12@localhost ~]$

When checking the emagent.nohup file, there was an error related to java memory:

Agent is going down due to an OutOfMemoryError
----- Fri May 13 10:46:21 2016::18719::Checking status of EMAgent : 19177 -----
----- Fri May 13 10:46:21 2016::18719::EMAgent exited at Fri May 13 10:46:21 2016 with return value 57. -----
----- Fri May 13 10:46:21 2016::18719::EMAgent will be restarted because of an Out of Memory Exception. -----
----- Fri May 13 10:46:21 2016::18719::EMAgent is Thrashing. Exiting loop. -----
----- Fri May 13 10:46:21 2016::18719::Commiting Process death. -----
----- Fri May 13 10:46:21 2016::18719::writeAbnormalExitTimestampToAgntStmp: exitCause=OOM : restartRequired=0 -----
----- Fri May 13 10:46:21 2016::18719::Exited due to Thrash. -----

As the error shows, it was an "Out of Memory Exception". To solve it, I had to increase the java heap space allocated to emagent.

Edit '$AGENT_BASE/agent_inst/sysman/config/emd.properties' and increase the memory allocated to 512M (a good and enough value).

Before:

[emc12@localhost config]$ cat emd.properties | grep agentJavaDefines
agentJavaDefines=-Xmx128M -XX:MaxPermSize=96M

After edited:

[emc12@localhost config]$ cat emd.properties | grep agentJavaDefines
agentJavaDefines=-Xmx512M -XX:MaxPermSize=96M

Finally, try to restart agent running "emctl start agent":

[emc12@localhost ~]$ emctl start agent
Oracle Enterprise Manager Cloud Control 12c Release 5
Copyright (c) 1996, 2015 Oracle Corporation.  All rights reserved.
Starting agent ..................... started.

Great, agent is back to life. However, if you still face any issues, you will need to clear the agent state and retry.

Do the following:

  1. Stop and kill any remaining process related to EM Agent that is still running (perl or java).
  2. Clean all files from '$AGENT_BASE/agent_inst/sysman/emd/state/*' folder (or move them to a temporary place).
  3. Clear agent state by running: emctl clearstate agent.
  4. Increase the memory allocated editing emd.properties, as showed before, if not already done.
  5. Try to start the agent again.

 

More information can be found at the MOS Doc ID below:

 

Have you enjoyed? Please leave a comment or give a 👍!

2 comments

    • Terry on September 5, 2017 at 10:41
    • Reply

    Perfect, fixed my problem immediately.

    • imadjundi on May 9, 2018 at 07:00
    • Reply

    Thanks very much.
    I need to delete state files and clear the agent state

Leave a Reply

Your email address will not be published.