Resolving Common Jenkins Compatibility Issues and Optimizing Performance
This guide details how to address Jenkins Performance plugin compatibility problems, modify CSP security policies, customize the Jenkins context path, fix git clone timeouts, resolve batch command failures, replace vulnerable JARs, run JNLP files on Windows agents, disable CSRF protection, adjust JVM memory settings, and implement disk space and build timeout optimizations.
Performance Plugin Compatibility Issues
In freestyle projects, the Performance plugin collects build artifacts, but with the latest versions (Jenkins v2.298, Performance v3.19) it conflicts with Jenkins, causing table and div misalignment on the configuration page and preventing saving. The issue has persisted for months without a fix. Workarounds are:
Convert the freestyle job to a pipeline.
Manually edit the job’s config.xml on the server to enable saving.
Downgrade Jenkins; the plugin works on v2.263.4 LTS after backing up and checking other plugin compatibility.
Modifying Jenkins CSP Security Policy
When using the Robot Framework Plugin, previewing test reports fails with “Opening Robot Framework log failed” because Jenkins’s default Content‑Security‑Policy (CSP) blocks external HTML/JS. The default CSP is:
sandbox; default-src 'none'; img-src 'self'; style-src 'self';To relax the policy, create a startup job that runs a Groovy script:
Create a new job that runs on Jenkins startup.
In “Build Triggers”, select “Build when node starts”, leave label blank, set quiet period to 0.
In “Build”, choose “Execute system Groovy” and run:
System.setProperty("hudson.model.DirectoryBrowserSupport.CSP", "")Restart Jenkins; the Robot Framework report can now be accessed.
Custom Jenkins Context Path
When Jenkins is behind an Nginx proxy with other applications, you may need a custom relative path (e.g., /jenkins). Steps:
Edit jenkins.xml in the Jenkins installation directory.
Append --prefix="/jenkins" to the arguments node.
Restart Jenkins and access via http://localhost:29908/jenkins.
Test the proxy.
If agents were already connected via JNLP before the proxy change, update the jnlpUrl in jenkins-slave.xml accordingly.
git clone failure: Killed by signal 15
Large repositories or slow networks may exceed the default 10‑minute clone timeout, causing Jenkins to kill the job. Increase the timeout in the job configuration to prevent the failure.
Build step “Execute Windows batch command” marked build as failure
Add exit 0 as the last line of the batch script to ensure the step returns success.
Replacing vulnerable JAR in Jenkins running on Tomcat
To replace commons-fileupload-1.3.1-jenkins-2.jar with version 1.4, create a symbolic link to the new JAR, delete the old one, and restart Tomcat.
mklink webapps\jenkins\WEB-INF\lib\commons-fileupload-1.3.1-jenkins-2.jar webapps\jenkins\WEB-INF\lib\commons-fileupload-1.4.jarRunning JNLP files on Windows agents
If double‑clicking a .jnlp file does nothing, run it from the command line with javaws slave-agent.jnlp and adjust Java security settings as needed.
Disabling CSRF Protection
For Jenkins versions before v2.204.6, CSRF can be disabled in the global security settings. In newer versions, add the JVM argument
-Dhudson.security.csrf.GlobalCrumbIssuerConfiguration.DISABLE_CSRF_PROTECTION=trueeither in Tomcat startup scripts or when launching the Jenkins JAR.
-Dhudson.security.csrf.GlobalCrumbIssuerConfiguration.DISABLE_CSRF_PROTECTION=trueAdjusting JVM Memory Settings
Default JVM memory may be insufficient, leading to OutOfMemoryError: PermGen space. Example settings:
set JAVA_OPTS=
-server
-Xms5000M
-Xmx5000M
-Xss512k
-XX:+AggressiveOpts
-XX:+UseBiasedLocking
-XX:PermSize=256M
-XX:MaxPermSize=512M
-XX:+DisableExplicitGC
-XX:MaxTenuringThreshold=31
-XX:+UseConcMarkSweepGC
-XX:+UseParNewGC
-XX:+CMSParallelRemarkEnabled
-XX:+UseCMSCompactAtFullCollection
-XX:LargePageSizeInBytes=128m
-XX:+UseFastAccessorMethods
-XX:+UseCMSInitiatingOccupancyOnly
-Djava.awt.headless=trueOptimizing Disk Space Usage
Configure build discard policies to keep only recent builds (e.g., retain builds from the last 2 days and a maximum of 30 builds). Use the Disk Usage plugin cautiously as it may cause server lag.
Set up a scheduled job to delete old Tomcat logs to prevent log accumulation.
Setting Build Timeout
Configure a timeout for jobs that hang excessively to avoid high memory consumption and potential Jenkins crashes.
Configuring Global Properties
Define environment variables in “Manage Jenkins → Configure System → Global properties” to avoid hard‑coding values in pipelines.
Managing Scripts Centrally
Install the “Managed script” plugin, add Groovy scripts under “Managed files”, and invoke them via “Execute managed script” in jobs.
Lightweight Backup
Use the “ThinBackup” plugin for full or incremental Jenkins configuration backups without stopping the server; it does not back up build history or artifacts.
To restore a backup, use the plugin’s restore function.
Architect's Must-Have
Professional architects sharing high‑quality architecture insights. Covers high‑availability, high‑performance, high‑stability designs, big data, machine learning, Java, system, distributed and AI architectures, plus internet‑driven architectural adjustments and large‑scale practice. Open to idea‑driven, sharing architects for exchange and learning.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
