Skip to content

MarkEWaite/JGit-7.2.0

#!/bin/bash

# Tset JGit 7.3.0 for file leak
#
# Compare JGit 7.0.0 and JGit 7.3.0 with file leak detector watching the operations
#
# JGit 7.3.0 seems to have a repeatable leak in file.Pack.doOpen() when called through
# RevWalk.parseCommit() and RevWalk.parseAny()
#
# See the issue by running this README.  Complete the setup wizard
# by creating a new user and installing no additional plugins.  Run the
# jobs each once, then enable file leak detector from "Manage Jenkins" ->
# "Open File Handles".  Run the jobs again and check the open file handles
# page at /manage/file-handles/
#
# File handle leaks are not reported for JGit 7.0.0 as included in git client 6.1.x.
# File handle leaks are reported for JGit 7.3.0 as included in git client 6.2.0 incremental.
#
# The following script will run all the jobs from "Manage Jenkins" -> "Script Console"
#
# Jenkins.instance.getAllItems(org.jenkinsci.plugins.workflow.job.WorkflowJob.class).findAll().each {
#     it.scheduleBuild(0, new hudson.model.Cause.UserIdCause())
#     println('Scheduled ' + it.fullName)
# }
# return ""

JENKINS_WAR_VERSION=2.504.3
JENKINS_WAR=jenkins-${JENKINS_WAR_VERSION}.war
PLUGIN_MANAGER_VERSION=2.13.2
PLUGIN_MANAGER_JAR=jenkins-plugin-manager-${PLUGIN_MANAGER_VERSION}.jar

if [ ! -f ../$PLUGIN_MANAGER_JAR ]; then
  wget https://github.com/jenkinsci/plugin-installation-manager-tool/releases/download/${PLUGIN_MANAGER_VERSION}/$PLUGIN_MANAGER_JAR
  mv $PLUGIN_MANAGER_JAR ..
fi
[ ! -d plugins ] && mkdir plugins

java -jar ../$PLUGIN_MANAGER_JAR --jenkins-version $JENKINS_WAR_VERSION --latest false --plugin-download-directory plugins --plugin-file plugins.txt

# Replace the git-client plugin with a repaired version if USE_THE_FIX env var is non-empty
[ -z "$USE_THE_FIX" ] || cp git-client-issue-155.jpi plugins/git-client.jpi

if [ ! -f ../$JENKINS_WAR ]; then
  wget https://get.jenkins.io/war-stable/${JENKINS_WAR_VERSION}/jenkins.war
  mv jenkins*.war ../$JENKINS_WAR
fi

# Set JGit cleanup parameters globally (does not resolve the leaks)
#
# https://eclipse.gerrithub.io/c/eclipse-jgit/jgit/+/74904
#
# Inspired by comments from Matthias Sohn in:
#
# eclipse-jgit/jgit#155
#
git config --global core.repositoryCacheExpireAfter 100
git config --global core.repositoryCacheCleanupDelay 1397

JENKINS_HOME=. java -XX:+EnableDynamicAgentLoading -jar ../$JENKINS_WAR

About

JGit 7.2.0 file descriptor leak exploration

Resources

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages