Spencer Bharath
Spencer Bharath

Reputation: 567

Jenkins Utilizing 100% CPU

I am running a Jenkins Server at AWS in m3.medium Server. My Jenkins server even when it is idle it is using 100% CPU and crashing. I Googled about these issues and most the solution was to delete old build and reload configuration from the disc but nothing happened. Jenkins was still using 100% CPU and crashing .

There only 20 jobs and in my server and it has Github project configured to build when ever a new branch or a PR is raised .

Is there a way to solve this Issue ??

Upvotes: 3

Views: 12354

Answers (5)

sdhokaumd
sdhokaumd

Reputation: 21

I faced similar issue with amazon ec2 plugin when creating windows nodes. The issue in my case was caused because of certain daemon "input copy:" threads (supposed to create temporary directory on slave) that were not getting killed even after the slave termination. Review the active threads on Jenkins using the monitoring plugin and identify the threads with unusually high cpu time. Determine if the thread is spun by a plugin or the jenkins application itself(Dump the thread stack or hover over the thread to see the stack). Lookup if this is a known issue with the app/plugin and upgrade or downgrade accordingly.

In case you don't find suspicious threads from the jenkins application page, login to the server and check if the cpu spike is caused by some other daemon process running on the system

Upvotes: 1

vargen_
vargen_

Reputation: 2790

I had a similar problem. Our Jenkins started to consume nearly 100% CPU. It's a master-only setup, on an AWS EC2 instance. I was able to SSH into the machine without a problem. Via top I saw the high CPU consumption was caused by the jenkins process. After a sudo service jenkins restart the CPU usage dropped back to basically 0%.

Only after I tried to open a specific job on the UI went the CPU up to 100% again. I tried deleting the whole /var/lib/jenkins/workspace folder, but id didn't help.

What ended up working is deleting the job itself from the terminal and recreating it from the UI. I know it's not a real fix, but might help somebody.

Upvotes: 0

ADV-IT
ADV-IT

Reputation: 831

I had same issue, strange fix for me is to delete old workspace folders

sudo rm -rf /var/lib/jenkins/workspace/*

CPU dropped down immediately from 100% to 0%

Upvotes: 4

Daniel Steinmann
Daniel Steinmann

Reputation: 2199

We also observed high CPU usage on a Solaris 10 machine (Jenkins slave) after a job has run there. Thread dumps showed an endless loop in ProcessTreeKiller code.

Starting Jenkins with -Dhudson.util.ProcessTree.disable=true solved the issue.

Upvotes: 1

Max Young
Max Young

Reputation: 1662

Sounds like you may be running out of heap space. If you don't configure this and you get close to the limit the process will spend a ton of CPU cycles performing garbage collection. Here is how to configure it on Ubuntu.

How do I give Jenkins more heap space when it's running as a daemon on Ubuntu?

Upvotes: 1

Related Questions