Welcome to the Linux Foundation Forum!

Lab3.5 JVM memory and Artifactory upload issues

I just manage to complete the Lab3.5 exercise after running into a few issues and wanted to share.
I am using

  • Vagrant on Windows
  • Virtualbox with Ubuntu
  • Jenkins 2.164.1
  • Artifactory 6.9.1

Initially I had problems with JVM crashing due to memory limitations. That lead me to set or reduce the maximum memory allocation setting for Maven, Artifactory, and Jenkins. Here are the steps I took:

  1. In Artifactory configuration file /etc/opt/jfrog/artifactory/default changed the java parameters

export JAVA_OPTIONS="-server -Xms512m -Xmx2g -Xss256k -XX:+UseG1GC -XX:OnOutOfMemoryError=\"kill -9 %p\""
to
export JAVA_OPTIONS="-server -Xms256m -Xmx512m -Xss256k -XX:+UseG1GC -XX:OnOutOfMemoryError=\"kill -9 %p\""

  1. In jenkins UI set the java parameters for Global Maven Options under: Jenkins -> Manage Jenkins -> Configure system

  2. In jenkins configuration file /etc/default/jenkins added the java parameter.

JAVA_ARGS="-Xmx512m"

  1. Finally I also increased the memory on the VM by editing the vagrantfile and increased the memory from 2g to 4g

vb.memory = "4096"

This resolved problem with JVMs crashing. Now there was a new issue with uploading to Artifactory. The Console Output showing the following:

[WARNING] Error occurred for request PUT /artifactory/libs-snapshot-local/org/springframework/samples/spring-petclinic/1.0.1-SNAPSHOT/spring-petclinic-1.0.1-SNAPSHOT.war;vcs.revision=4da9e63be3ab73bdf0c08157f32502c5f0467bff;build.timestamp=1555889523120;build.name=spring-petclinic-build;build.number=19 HTTP/1.1: Broken pipe (Write failed).
[WARNING] Attempting retry #1
[INFO] I/O exception (java.net.SocketException) caught when processing request to {}->http://localhost:8081: Broken pipe (Write failed)

I was able to find help here https://medium.com/@anusha.sharma3010/integrating-jenkins-with-artifactory-6d18974d163d
And created 2 local repositories in Artifactory under: Admin -> Repositories ->Local -> New

  • lib-release-local of type Maven with the checkbox "Handle Releases" selected.
  • lib-snapshot-local of type Maven with the checkbox "Handle Snaphsots" selected.

That solved all the issues and I finally got a successful run.

Comments

  • @opulent thank you for sharing your debugging process and this would also be helpful for many others who find themselves in the similar situation.

    To note, I do not recommend running Artifactory + Jenkins on the same VM as there is a good chance that it leads to performance degradation. Keeping it on separate hosts/vms is always a good idea.

Categories

Upcoming Training