After upgrading a Jenkins controller (formerly “master”), the web UI displays the “Please wait while Jenkins is getting ready to work” message for an unusually long period of time. In the service logs you see a continual stream of entries like this:
22-Nov-2020 13:20:03.008 INFO [Jenkins initialization thread] jenkins.model.Jenkins.<init> deleting obsolete workspace /jenkins_home/workspace/my-sample-project
- CloudBees CI (CloudBees Core)
- CloudBees CI (CloudBees Core) on traditional platforms - Client Master
- CloudBees CI (CloudBees Core) on traditional platforms - Operations Center
- CloudBees Jenkins Platform - Client Master
- CloudBees Jenkins Platform - Operations Center
- CloudBees Jenkins Distribution
- Jenkins LTS
This issue can occur when Jenkins tries to clean up old workspaces for jobs and branches that no longer exist. In cases where the workspace directory is very large (hundreds of GB) and/or storage performance is slow, this cleanup can take an extremely long time, and the service startup is blocked until the cleanup finishes. The workspace directory is used as a cache of SCM repositories that have been checked out previously, to help speed up builds by avoiding the need to clone the entire repo again.
Because the workspace directory is only a cache, it is safe to delete it if the obsolete workspace cleanup process is preventing your controller from starting up in a timely way. The workaround steps are as follows:
- Stop the controller service.
- Start the controller service again.
- Once service is restored, you can delete the
cache.olddirectories if you wish (this is advisable as otherwise they may waste significant disk space.
Branch API plugin 2.0.21 and newer.