question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

default -Xmx8G in wrapper-properties.conf has no effect on agent.jar

See original GitHub issue
Bug Report / Documentation Report
Summary

After encountering for a few times this error:

2020-01-24 14:48:38,619 ERROR [scheduler-2] TaskUtils$LoggingErrorHandler:95 - Unexpected error occurred in scheduled task.
java.lang.OutOfMemoryError: Java heap space

I decided to increase memory for the go-agent. According to this comment and performance tuning docs wrapper-properties.conf is the right place. So I removed # from wrapper.java.additional.105=-Xmx8G in /usr/share/go-agent/wrapper-config/wrapper-properties.conf

It turned out it has no effect.

After some digging I added -Xms1g -Xmx2g to set.default.AGENT_STARTUP_ARGS parameter in wrapper.conf (instead wrapper-properties.conf) and that fixed the java.lang.OutOfMemoryError problem. I’ve noticed that:

  1. wrapper.java.additional.* in wrapper-properties.conf works only for agent-bootstrapper.jar
  2. AGENT_STARTUP_ARGS in wrapper.conf works for agent.jar, besides Xmx it was also tested with -Dtoggle.agent.git.clean.keep.ignored.files
Environment
Basic environment details
  • Go Version: go-agent 19.7.0-9567
  • JAVA Version: OpenJDK 64-Bit Server VM AdoptOpenJDK (build 12.0.1+12, mixed mode, sharing)
  • OS: Ubuntu 16.04 xenial
Additional Environment Details

Agent installation was upgraded from /etc/default/go-agent

Possible Fix

I’m not familiar with java service wrapper but this line is commented out https://github.com/gocd/gocd/blob/master/installers/include/additional-properties.conf#L3

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
arvindsvcommented, Feb 14, 2020

@suside That change you proposed makes sense to me.

You see Xmx in the docs and in the file, which is present on the agent… well it was confusing.

Yes, I understand. If someone gets confused, I think it’s on the documentation to be less confusing and not on the person to have “known better”. So, it’s definitely not on you. 😃

0reactions
susidecommented, Feb 14, 2020

I made some changes to make it more clear in #7736, and I’ll update the docs a bit to fix the obvious errors at least. But feel free to make further edits.

👍 What you think about splitting performance_tuning.md Things to Remember into two sections like so https://github.com/suside/docs.go.cd/commit/b0911c08098ff56bc3a67d9538f4d43be11ea44e

I checked and it is clear from the docs that it is talking about the GoCD server and not the agent, but I’ll make a small improvement there.

Yeah, it kinda is now for me too, but when searching for mem error for the first time… You see Xmx in the docs and in the file, which is present on the agent… well it was confusing.

Read more comments on GitHub >

github_iconTop Results From Across the Web

gocd agents crashing after starting · Issue #6971 - GitHub
Agents are showing as lost contact with the server. ... You might want to set the Xmx property in wrapper-properties.conf , or run...
Read more >
java - How to set the -Xmx when start running a jar file?
-Xmx must be passed to the Java runtime environment, not to the executed jar. ... by default: Win7 guide; Restart your jar with...
Read more >
Performance Tuning | GoCD User Documentation
The default values for the GoCD server are -Xms512m (minimum) and -Xmx1024m (maximum). To utilize more heap space, set the JVM option -Xmx...
Read more >
agent.conf Collector Settings - LogicMonitor
This property is not added by default to the agent.conf. ... Ensure that the related jar is added in wrapper.conf before changing this ......
Read more >
Include the Java agent with a JVM argument
If using the agent API: Specify the path to newrelic-api.jar in the ... 9 or higher make sure that the -javaagent property is...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found