However well a platform is set up, something will eventually fail: a build that never leaves the queue, an agent that disconnects, a disk that fills up on a Sunday, a plugin that prevents startup after an upgrade or a webhook that stops arriving. What sets an effective platform team apart is not that it has no incidents, but that it diagnoses them methodically instead of trying things at random. In this lesson you will learn a diagnostic methodology, the tools that Jenkins and its environment provide to apply it, and a catalog of the most frequent problems with their symptom, probable cause, diagnosis, solution and prevention, always on the TecnoShop platform you have built. You will finish with the incident runbook that Laura writes down for whoever is on call.
Diagnostic Methodology
When faced with a problem, the temptation is to restart Jenkins, rerun the build or upgrade a plugin "just in case". Sometimes it works, but it wipes out the clues and does not prevent it from happening again. TecnoShop's method has seven steps:
flowchart TD
S["1. Symptom<br/>exactly what is observed"] --> R["2. Reproduce<br/>always, sometimes, since when?"]
R --> A{"3. Narrow down the layer"}
A -->|"every build, the interface"| CT["Controller"]
A -->|"one agent or one label"| AG["Agent"]
A -->|"after installing or upgrading"| PL["Plugin"]
A -->|"one job or one branch"| PI["Pipeline"]
A -->|"connections, timeouts"| RE["Network"]
A -->|"the command also fails by hand"| HE["Tool"]
CT --> L["4. Logs and evidence"]
AG --> L
PL --> L
PI --> L
RE --> L
HE --> L
L --> H["5. Hypothesis<br/>one at a time, testable"]
H -->|"not confirmed"| L
H -->|"confirmed"| F["6. Fix<br/>minimal and reversible"]
F --> P["7. Prevention<br/>alert, test, runbook or code"]
- Symptom: describe it precisely. "Jenkins is acting up" is no use; "since 10:40,
catalog-webbuilds have been waiting in the queue with the message Waiting for next available executor on 'docker'" is. - Reproduce: does it always happen or only sometimes? On every branch? Since when? What changed at that moment? The
git logofjenkins-configandjenkins-shared-libanswers that last question in seconds, a direct benefit of having everything as code. - Narrow down the layer: the most valuable question. If only one job fails, the controller is not to blame; if the command also fails when you run it by hand on the agent, Jenkins is not to blame.
- Logs and evidence: the build console, the system log, the agent log, the container log, Kubernetes events, webhook deliveries. Copy the messages verbatim.
- Hypothesis: one at a time, which can be confirmed or ruled out with a specific test. Changing three things at once makes it impossible to know which one fixed it.
- Fix: minimal and reversible. If it is urgent, mitigate first (for example, by taking an agent offline) and then fix it calmly.
- Prevention: whatever keeps it from happening again or, if it does happen again, catches it sooner: an alert, a test in the
jenkins-configCI, a runbook, one more line in JCasC.
Diagnostic Tools
System Log and Log Recorders
Manage Jenkins → System Log shows the controller's general log. For specific problems, a log recorder captures messages from specific components in more detail, like the git-and-credentials one from 05-05. A few useful ones (logger names are the Java packages of each plugin and can change between versions; check them in the plugin itself):
| Problem | Indicative loggers | Level |
|---|---|---|
| GitHub webhooks | com.cloudbees.jenkins.GitHubWebHook, org.jenkinsci.plugins.github |
FINE |
| Branch discovery and events | jenkins.branch, jenkins.scm.api |
FINE |
| Agents on Kubernetes | org.csanchez.jenkins.plugins.kubernetes |
FINE |
| JCasC | io.jenkins.plugins.casc |
FINE |
FINEgives detail;ALLorFINESTcan generate so much volume that it slows down the controller. Enable the recorder, reproduce the problem and disable it when you are done.- Log recorders live in memory (the most recent messages); if you need to keep them, copy them when you are done.
Container and Agent Logs
# Controller: last 30 minutes, with timestamps
docker compose logs --since 30m --timestamps jenkins-controller
# Permanent agent: the connection process (remoting)
docker compose logs --since 30m linux-agent-01
# Did the container die from lack of memory? (true = the system killed it, not the JVM)
docker inspect --format '{{.State.OOMKilled}} {{.State.ExitCode}}' jenkins-controller- The controller container log includes the full startup: that is where plugin and JCasC errors appear before the interface even exists.
- In the interface, Manage Jenkins → Nodes → linux-agent-01 → Log shows the controller's side of the connection with the agent. Compare both sides: often one says "connection closed" and the other explains why.
- An
ExitCodeof 137 withOOMKilled truemeans the container exceeded its memory limit; anOutOfMemoryErrorin the log means the JVM ran out of heap. They are different problems with different solutions (section 5).
Thread Dump and jstack
When the controller is slow or a build seems stuck, a thread dump shows what each thread is doing at that moment:
- Interface: Manage Jenkins → System Information → Thread Dumps, or
/threadDumpdirectly. For a pipeline build, the Thread Dump link on the build page shows which step each branch is on (03-06). - Command line, useful when the interface does not even respond, if the image includes the JDK tools:
# Find the Jenkins JVM inside the container and dump its threads
docker compose exec jenkins-controller jcmd -l
docker compose exec jenkins-controller jcmd <PID> Thread.print > dump-1.txt
sleep 10
docker compose exec jenkins-controller jcmd <PID> Thread.print > dump-2.txtjcmd -llists the JVMs and their PIDs;Thread.printis equivalent tojstack <PID>. If your image does not include these tools, the dump from the interface is the alternative.- Two or three dumps a few seconds apart: a thread that shows up at the same point in all of them is blocked; one that changes is working. A single dump is a snapshot; several are a movie.
- Look for
BLOCKEDthreads, many threads waiting on the same lock (waiting to lock <0x...>) and names that give away the plugin involved (Handling GET /job/...,Computer.threadPoolForRemoting,jenkins.util.Timer).
The Support Core Plugin: The Support Bundle
The Support Core plugin generates, from Manage Jenkins → Support, a zip file with what is usually requested for a diagnosis: Jenkins, Java and plugin versions, node configuration, statistics, recent logs, thread dumps and metrics. It lets you choose which components to include.
- It is what maintainers ask for when you report a problem (Jenkins Community and Resources), and what Laura attaches to an internal incident.
- Review it before sharing it outside TecnoShop. Although the plugin does not include credential secrets and offers anonymization options, logs and configuration can contain server names, internal URLs, user names or console fragments. Uncheck the components you do not need, open the zip and look for internal names before sending it.
Script Console: Read-Only, and with Caution
The Script Console (Manage Jenkins → Script Console) runs Groovy with full access to the controller (05-02). For diagnosis, use it only with read-only scripts that have been reviewed and stored in the platform repository:
// Read-only: what is in the queue and why each item is waiting
Jenkins.get().queue.items.each { item ->
println "${item.task.fullDisplayName} | queued since ${new Date(item.inQueueSince)} | ${item.why}"
}Jenkins.get().queue.items: the items in the queue;whyis the same text you see in the interface and in the API (08-04).- If the REST API offers the same information, prefer it: it is limited by permissions and cannot modify anything by mistake.
- Never paste into the console a script found on the Internet that modifies things (deleting builds, changing credentials) without understanding every line and without a recent backup. A mistake there has no Undo.
The Catalog: Summary Table
| Symptom | Usual layer | First check | Section |
|---|---|---|---|
| Build stuck in the queue forever | Agent, label, cloud | Queue message (why) |
4 |
| Agent disconnected or unable to connect | Agent, network | Node log on both sides | 4 |
| Full disk | Controller or agent | du -sh of the directory |
4 |
Slow controller or OutOfMemoryError |
Controller | Heap, thread dumps | 5 |
| Jenkins does not start after an upgrade | Plugin, JCasC | Container log at startup | 5 |
| No administrator access | Security | What changed in casc/jenkins.yaml or in the interface |
5 |
RejectedAccessException / NotSerializableException |
Pipeline | The stack trace in the console | 6 |
| Git authentication or host verification failure | Credential, network, clock | Git's exact message | 7 |
| Webhooks that do not trigger | Network, configuration | Recent Deliveries in GitHub | 7 |
| Multibranch that does not see branches or PRs | Configuration, permissions | Scan Multibranch Pipeline Log | 7 |
Locked workspace, @tmp, @2 |
Agent, pipeline | Processes and file owners | 8 |
| Docker errors | Agent, TLS | docker version on the agent |
8 |
Pod Pending, ImagePullBackOff, permissions |
Kubernetes | kubectl describe pod and events |
8 |
| A secret visible in the log | Pipeline | How the value reached the output | 9 |
cron at an unexpected time |
Configuration | Time zone and H |
9 |
input that blocks |
Pipeline | Where the input is and its timeout |
9 |
| Quality Gate that never responds | Integration | Webhook deliveries in SonarQube | 9 |
Builds and Agents: Queue, Disconnections and Disk
Build Stuck in the Queue Forever
- Symptom: the build appears in Build Queue and does not start; in the Console Output,
Waiting for next available executor...orStill waiting to schedule task. - Probable cause: there is no free executor for its label, nobody offers that label, the agents that offer it are offline, the cloud cannot provision, or the build is waiting by design (a
lock,disableConcurrentBuilds). - Diagnosis: the queue message almost always states the cause. Hover over the queue item or request the
whyfield through the API (08-04):
| Message (indicative) | Meaning | Action |
|---|---|---|
Waiting for next available executor on 'docker' |
There are agents with that label, but they are all busy | Capacity (08-05), or a stuck build holding the executor |
There are no nodes with the label 'linux-docker' |
Nobody offers that label: a typo or a retired label | Fix the label (linux && docker, not linux-docker) |
All nodes of label 'linux' are offline / 'linux-agent-01' is offline |
The agent is disconnected | Next section |
Build #57 is already in progress |
disableConcurrentBuilds(): waiting by design |
Normal; if the previous build is stuck, check its timeout |
Waiting for resource env-staging (in the build console) |
Another build holds the lock |
See who holds it in Lockable Resources |
Waiting for next available executor on '<pod-name>' for minutes |
The pod has been requested but does not start | Kubernetes (section 8) |
- Solution: according to the table. For clouds, also check the cloud's limit (Concurrency Limit): if 4 pods are running and the limit is 4, the fifth one waits even if the cluster has resources.
- Prevention: the
JenkinsLongQueuealert, labels documented injenkins-config, and atimeoutin every pipeline so that a stuck build does not hold executors.
Agent Disconnected or Unable to Connect
- Symptom: the node appears with a red cross in Nodes; builds wait with
... is offline; or a build fails withChannelClosedExceptionorAgent went offline during the build. - Probable causes and diagnosis:
| Cause | How to recognize it | Solution |
|---|---|---|
| Wrong secret | The agent log shows the connection being rejected (403 or similar); typical after rebuilding Jenkins from scratch, because the secret depends on the controller's internal key (08-03) | Copy the new secret from Nodes → linux-agent-01 into .env and recreate the agent container |
| WebSocket blocked | A connection that drops shortly after starting or a handshake error; happens behind a proxy that does not forward Upgrade/Connection |
Configure the proxy for WebSocket, as in the nginx from 05-02 |
| Controller URL | The agent tries to connect to localhost or to a URL that does not resolve from its network |
The agent's JENKINS_URL (or the cloud's Jenkins URL) as seen from the agent |
| Java version | The agent starts and exits with a class version error or an unsupported Java warning | The current LTS requires a minimum Java version on the agents too; use the inbound-agent image from the same generation as the controller |
| Remoting version | Incompatibility warnings after upgrading the controller | Update the jenkins/inbound-agent tag (and the tecnoshop/linux-agent one) with every core upgrade, as the calendar from 05-04 requires |
| Clock skew | The Clock Difference monitor in Nodes shows minutes of difference; TLS failures or failures with expiring tokens | NTP on the machines; in containers, the host's clock |
| Agent disk or memory | The node is marked offline on its own, with the reason on its page (the Free Disk Space threshold) | Next section |
- Prevention: the offline nodes alert (05-05), agent images upgraded together with the core and, for anything new, ephemeral agents, which do not "disconnect": they are recreated.
Full Disk on the Controller or on an Agent
- Symptom: builds that fail with
No space left on device, an agent that goes offline because of Free Disk Space, or a controller that stops saving configurations and builds. - Diagnosis:
# Controller: what takes up the most space in JENKINS_HOME
docker compose exec jenkins-controller sh -c 'du -sh /var/jenkins_home/* 2>/dev/null | sort -h | tail -n 10'
docker compose exec jenkins-controller sh -c 'du -sh /var/jenkins_home/jobs/* 2>/dev/null | sort -h | tail -n 10'
# Permanent agent: workspaces and caches
docker compose exec linux-agent-01 sh -c 'du -sh /home/jenkins/agent/* 2>/dev/null | sort -h'
# Build daemon: images, containers and build cache
docker compose exec docker-dind docker system dfsort -hsorts by human-readable size (K, M, G);tail -n 10shows the ten largest.- On the controller, the usual suspects are
jobs/(history without retention, archived artifacts, huge logs),workspace/and.m2/left over from the built-in node (which 05-04 already invited you to delete),logs/andfingerprints/. - On the agent: orphaned workspaces and caches. In
docker-dind, accumulated layers and images. - Solution: on the spot, free up what is safe (orphaned workspaces,
docker image pruneof unused images in the build daemon, never a blinddocker system prune -a --volumes, which would also delete volumes with data), and then apply the retention that was missing (buildDiscarder, Global Build Discarders, artifacts in Nexus). Enlarging the disk is the last option, not the first. - Prevention: the retention policy from 09-01, a disk alert below 20% and a monthly review of the size of
jobs/.
The Controller: Slowness, Memory, Startup and Access
Slow Controller or OutOfMemoryError
- Symptom: the interface is slow to respond, builds are late to start or finish, and the log shows
java.lang.OutOfMemoryError: Java heap spaceorGC overhead limit exceeded; in the worst case, the container restarts. - Probable causes: not enough heap for the load; too much history or huge logs; a plugin that consumes memory or CPU; heavy Groovy in the pipelines (which runs on the controller); many API queries with
depth; massive polling. - Diagnosis:
- Was it killed by the container or by the JVM?
docker inspect(section 2):OOMKilled truepoints to a container limit without headroom above-Xmx(08-05). - The "Jenkins - Health" dashboard: does the heap stay high after collections? If it drops after each GC, there is pressure but no leak; if the floor rises day after day, something is holding on to memory.
- Thread dumps during the slowdown: which threads are busy, and with what?
- If it keeps happening, a heap dump on the next failure (
-XX:+HeapDumpOnOutOfMemoryErrorwith-XX:HeapDumpPathon a disk with space) to analyze it with a heap analysis tool.
- Was it killed by the container or by the JVM?
- Solution: mitigate by restarting in an orderly way (Prepare for Shutdown and a safe restart, so as not to lose pipelines), and then address the cause: more heap, with headroom in the container, if the load justifies it; retention; removing or upgrading the offending plugin; moving Groovy to the agent. Tuning the JVM and the controller is the subject of Optimizing Jenkins Performance.
- Prevention: the
JenkinsHighHeapalert, capacity trends, plugin reviews.
Jenkins Does Not Start After an Upgrade
- Symptom: after changing the controller image, the interface does not appear or shows errors; in the container log, messages such as
Failed Loading plugin X,Plugin is missing: Y (version),Update required: Z,SEVERE: Failed to initialize Jenkins, or JCasC errors (ConfiguratorException,No configurator for the following root elements). - Probable cause: unsatisfied plugin dependencies, a plugin incompatible with the core or Java version, or a JCasC key that the new version of a plugin no longer recognizes.
- Diagnosis: the container log from the very beginning of startup; the first error is usually the cause, and the ones that follow are consequences.
- Solution, from most to least preferable:
- Go back to the previous image, which is the rollback plan from 05-04: change the tag in
docker-compose.ymland recreate the container. WithPLUGINS_FORCE_UPGRADE, the image's plugins are copied to the volume again. If the new version had already migrated configuration files, restore the cold backup taken before the upgrade. - Disable a specific plugin that prevents startup while you investigate. Jenkins does not load a plugin if there is a
<plugin>.jpi.disabledfile next to it:
- Go back to the previous image, which is the rollback plan from 05-04: change the tag in
docker compose stop jenkins-controller
docker run --rm -v jenkins_home:/var/jenkins_home alpine sh -c '
ls /var/jenkins_home/plugins/ | grep -i plugin-name
touch /var/jenkins_home/plugins/plugin-name.jpi.disabled
chown 1000:1000 /var/jenkins_home/plugins/plugin-name.jpi.disabled
'
docker compose start jenkins-controller- The auxiliary
alpinecontainer mounts the volume while the controller is stopped, as in the backups from 05-03.ls ... | grepconfirms the exact file name (.jpior.hpi). chown 1000:1000: the owner used by the image'sjenkinsuser.- Careful: plugins that depend on the disabled one will not load either, and if
casc/jenkins.yamlconfigures the disabled plugin, JCasC will fail at startup. This is an emergency measure, not a solution. - Prevention: the
jenkins-configCI starts the candidate image with JCasC and fails if the log contains configuration errors (08-03);jenkins-testwith a restored backup before every upgrade; a cold backup beforehand.
Locked Out of Administrator Access
- Symptom: nobody can get into Manage Jenkins: an authorization strategy without administrators has been saved, the external Security Realm (LDAP, SSO) is not responding, or the password of the only administrator account has been lost.
- Diagnosis: what changed? With JCasC,
git log -p casc/jenkins.yaml; without JCasC, the Audit Trail log. Is it authentication that fails (you cannot log in) or authorization (you log in but cannot see anything)? - Solution with JCasC (TecnoShop's case): the source of truth is the YAML, and JCasC applies it at startup, so editing
config.xmlis no use (it gets overwritten). If the error is in the roles, the YAML is fixed through the normal procedure, with an urgent review. If a password from the built-in user database has been lost, it is enough to change the secret file (./secrets/LAURA_PASSWORD) and restart: JCasC sets the password when it applies the configuration. If the problem is SSO being down, you prepare an emergency file that temporarily replaces the authorization:
# Emergency block in a copy of casc/jenkins.yaml - ONLY TO RECOVER ACCESS. Remove as soon as it is fixed.
jenkins:
authorizationStrategy:
loggedInUsersCanDoAnything:
allowAnonymousRead: false- It temporarily replaces the
authorizationStrategyblock ofcasc/jenkins.yaml(for example, by mounting a copy of thecasc/directory with that block changed instead of the original: JCasC does not allow two files to define the same key, 08-03), with Jenkins reachable only from the administration machine: indocker-compose.yml,"127.0.0.1:8080:8080"instead of"8080:8080", and with the agents and the cloud stopped so that no builds run. - Solution without JCasC: the procedure from 05-02: stop Jenkins, edit
config.xmland replace<authorizationStrategy>withFullControlOnceLoggedInAuthorizationStrategy. Only if the Security Realm itself is broken (and there is no other way to authenticate) do you change<useSecurity>true</useSecurity>tofalse. - Warning: any of these measures disables a protection. During that time, anyone with access to the URL could administer Jenkins and read every credential. That is why you: isolate the controller (
127.0.0.1only, no agents), keep it that way for as short a time as possible, restore the correct configuration, check it with the affected accounts in a private window, review Audit Trail for that interval and document it in the incident minutes. - Prevention: the
jenkins-configCI checks thatlauracan authenticate against the test Jenkins; always two administrators; a second window with an open session when changing the authorization (05-02).
Pipelines: Sandbox and Serialization
RejectedAccessException
- Symptom: the build fails with
org.jenkinsci.plugins.scriptsecurity.sandbox.RejectedAccessException: Scripts not permitted to use method ...or... staticMethod .... - Cause: the
Jenkinsfile(which runs in the sandbox) uses a Groovy or Java method that is not on the allowlist (03-06). - Diagnosis: the stack trace gives the exact signature; Manage Jenkins → In-process Script Approval shows it as pending.
- Solution, in this order: (1) is there a step that does the same thing? (
readJSONinstead ofJsonSlurper,shwithjq,fileExistsinstead ofnew File(...)); (2) should it be in the trusted library, reviewed by platform?; (3) only if the signature is harmless, approve it. Never approve signatures such asjava.lang.Runtime exec,Jenkins getInstanceor access to controller files: they are equivalent to giving theJenkinsfileauthor administrator access. - Prevention: minimal Groovy (04-07) and a quarterly review of approved signatures.
NotSerializableException
- Symptom:
java.io.NotSerializableException: java.util.regex.Matcher(or another class) when reaching a step such asshorecho. - Cause: CPS execution saves the program's state to disk at every step; if at that moment a variable holds an object that cannot be serialized, it fails (03-02).
// Fails: the Matcher is still alive in a variable when the echo step runs
def m = (env.BRANCH_NAME =~ /release\/(.+)/)
if (m) {
echo "Branch version: ${m[0][1]}"
}
// Works: the value is extracted in a @NonCPS function, which is neither interrupted nor serialized
@NonCPS
String branchVersion(String branch) {
def m = (branch =~ /release\/(.+)/)
return m ? m[0][1] : null
}- In the first block,
mis ajava.util.regex.Matcherand is still in scope whenechoruns: Jenkins tries to serialize it and fails. - In the second,
@NonCPSruns the function as plain Groovy, without save points; it returns aString, which is serializable. Inside a@NonCPSfunction you cannot call pipeline steps. - Alternatives: the
==~operator (which returns a boolean) when you only need to know whether it matches, or doing the work withshon the agent. - Prevention: logic in the tool or in the library, not in
script.
Repositories and Events: Git, GitHub, Webhooks and Multibranch
Authentication Failures with Git or with the GitHub App
- Symptom:
Failed to connect to repository,Authentication failed,returned status code 128, or, in the multibranch scan, an error with thegithub-tecnoshopcredential. - Causes and diagnosis:
| Cause | Clue |
|---|---|
The tecnoshop-jenkins App is not installed on that repository |
A new repository from another team: the App installation on GitHub does not include it |
| The App has insufficient permissions | The scan works, but checks are not published or PRs are not visible (Contents, Metadata, Pull requests, Checks, Commit statuses) |
| Private key in the wrong format | Error reading the key: it must be in PKCS#8 (06-01) |
| Controller clock skew | The App authenticates with a token signed with a timestamp; if the clock is off by minutes, GitHub rejects it. Check the host's time |
| Wrong or missing credential in that scope | The job requests an ID that does not exist in its folder or in the global scope |
- Solution: depending on the cause. Manage Jenkins → Credentials → github-tecnoshop → Test Connection (or the Validate button in the multibranch source) confirms the credential in isolation.
SSH Host Key Verification
- Symptom:
Host key verification failedorNo ECDSA host key is known for ... and you have requested strict checking. - Cause: TecnoShop requires host keys to be verified: in Git, with
knownHostsFileVerificationStrategyin JCasC (08-03); in deployments, withStrictHostKeyChecking=yesanddeploy/known_hosts. It fails if the server is new, has been reinstalled or its key has changed. - Solution: verify the fingerprint through an independent channel (on the server itself,
ssh-keygen -lf /etc/ssh/ssh_host_ed25519_key.pub) and only then add it to the correspondingknown_hosts, through a PR, as in 06-06. Never disable verification "to get past it": that is exactly what an attacker would need to impersonate the production server.
Webhooks That Do Not Trigger
- Symptom: you push and Jenkins does not build until the daily fallback scan (or until you click Scan Multibranch Pipeline Now).
- Diagnosis: start in GitHub, in the repository: Settings → Webhooks → (the webhook) → Recent Deliveries. Each delivery shows the request and the response:
| What you see in the delivery | Probable cause | Solution |
|---|---|---|
| No recent deliveries | The webhook does not exist or is not subscribed to those events | Create or fix the webhook (push and pull request events) |
| Connection error or timeout | GitHub cannot reach the URL: Jenkins on localhost, a firewall, a stopped forwarding channel |
In the lab, check that the smee.io client is still running (06-01); in production, the proxy's public route |
404 |
Wrong URL: the trailing slash of /github-webhook/ is missing, or the proxy does not forward the path |
Fix the URL |
403 or signature error |
The secret does not match github-webhook-secret |
Make the secret the same in GitHub and in Jenkins |
200 but nothing gets built |
Jenkins received the event but did not associate it with any job | The multibranch repository URL does not match the event's, or the event does not meet the behaviors; look at the webhooks log recorder and Multibranch Pipeline Events |
- Redeliver (a button on each delivery) resends the event after you fix the cause: it is the best test.
- Prevention: the daily fallback scan limits the damage; a periodic check of failed deliveries saves you from finding out through complaints.
Multibranch That Does Not Discover Branches or PRs
- Symptom: a branch or a PR does not appear in the multibranch, or it appears but is not built.
- Diagnosis: the multibranch page → Scan Multibranch Pipeline Log (or Scan Repository Log) explains every decision of the last scan: which branches it found, which it discarded and why (for example,
'Jenkinsfile' not foundorDoes not meet criteria). Multibranch Pipeline Events shows the events received. - Frequent causes:
- Discovery behavior: with the "exclude branches that are also filed as PRs" strategy (
strategyId(1)in the Job DSL from 08-03), thefeature/...branch does not appear as a branch but asPR-N. That is expected. - PRs from forks: they are discovered but, with the Trust policy, they are built with the target branch's
Jenkinsfileif the author does not have permissions (04-05). - Tags: they are discovered, but by default they are not built automatically; at TecnoShop you click Build Now in the Tags tab (07-02), or you add a build strategy with the corresponding plugin.
- The
Jenkinsfileis missing on that branch or at the configured path (ci/Jenkinsfileinjenkins-config). - App permissions: without read access to Pull requests, PRs are not visible.
- Unstable
idin the source generated by Job DSL: every branch is rebuilt after each seed run (08-03).
- Discovery behavior: with the "exclude branches that are also filed as PRs" strategy (
- Solution: fix the cause and run a manual scan, checking the log again.
Workspaces, Docker and Kubernetes
Locked Workspace, @tmp and @2
| What you see | What it is | When it is a problem |
|---|---|---|
workspace/orders-api_main@2 |
A second workspace because two builds of the same job coincided on the same agent (01-03) | If @3, @4... pile up because of builds that never finish, or if a script assumes a fixed path |
...@tmp |
Auxiliary directory: temporary sh scripts, credential files from withCredentials |
If it remains after builds that ended with serious failures; it can be deleted while the agent has no builds |
...@script, ...@libs |
Checkout of the Jenkinsfile or of the library |
Normal |
- Locking symptom:
Unable to delete,AccessDeniedExceptionwhen cleaning the workspace, or a build that cannot write totarget/. - Causes: (1) a process that is still alive with open files (for example, the jar from the
Smokestage if the script does not kill it; that is whysmokeSpringBootusestrap ... EXIT, 04-07); (2) files created by another user: a container that ran asrootand left files in the workspace that thejenkinsuser (UID 1000) cannot delete. - Diagnosis:
ls -lnin the workspace (it shows the numeric UIDs) andps auxon the agent. - Solution: kill the process; for the ownership problem, delete from a container running as the same user that created the files and, above all, run the build containers with the agent's UID (the
securityContextwithrunAsUser: 1000inci/pod-ci.yamlfrom 08-02). - Prevention: ephemeral agents (the workspace dies with the pod),
cleanWs()on permanent agents,trapin scripts that start processes.
Docker Errors in Builds
| Message (indicative) | Cause | Solution |
|---|---|---|
Cannot connect to the Docker daemon at unix:///var/run/docker.sock |
The sh runs in an environment without DOCKER_HOST: another agent, a pod or a container that does not inherit the variables |
Run the stage on an agent with the docker label; check env | grep DOCKER in that step |
x509: certificate signed by unknown authority or tls: bad certificate |
Client certificates that do not match the daemon: they were regenerated when docker-dind and its certificate volume were recreated |
Have the agent mount the current client certificate volume (DOCKER_CERT_PATH), and recreate the agent after recreating docker-dind (08-01) |
http: server gave HTTP response to HTTPS client when publishing |
The lab registry is HTTP | Insecure registry configuration in the lab only (like TECNOSHOP_INSECURE_REGISTRY in 08-02); in production, HTTPS |
unauthorized or denied when publishing |
The registry-tecnoshop credential is wrong or has no permission on that repository |
Check the jenkins-push user and its role in Nexus |
toomanyrequests when pulling base images |
The public registry's limit on anonymous pulls | An image proxy in Nexus, and authentication |
The first check is always a sh 'docker version' step in the same stage. If the Server part does not appear, the problem is the connection to the daemon, not your Dockerfile.
Kubernetes Errors: Pending, ImagePullBackOff and Permissions
- Symptom: the build waits with Waiting for next available executor on '
' , and the pod never connects; or creating the pod fails. - Diagnosis (in the lab, with the kind context):
kubectl -n jenkins-agents get pods -l jenkins=agent
kubectl -n jenkins-agents describe pod <pod-name>
kubectl -n jenkins-agents get events --sort-by=.lastTimestamp | tail -n 20
kubectl -n jenkins-agents logs <pod-name> -c jnlpget pods -l jenkins=agent: the label that the cloud puts on every build pod (08-02).describe pod: the Events section at the end says why it does not start.logs -c jnlp: the agent log inside the pod; if the pod isRunningbut does not connect, the cause is here.
| Status or message | Probable cause | Solution |
|---|---|---|
Pending with Insufficient cpu / Insufficient memory |
The pod's requests (1.75 CPU and 3.5 GiB in orders-api) do not fit on any node |
Adjust the requests, free up nodes or use autoscaling (08-05) |
Pending with a volume that cannot be mounted |
cache-ci is ReadWriteOnce and is mounted on another node |
The cache alternatives from 08-02; in the lab, a single node |
Pending with didn't match node selector or taints |
nodeSelector/tolerations that do not match the cluster |
Remove or fix those lines (kind has no node groups) |
ImagePullBackOff / ErrImagePull |
Nonexistent image name or tag, unreachable registry or no authentication | describe pod shows the exact image; check that it exists (crane ls), the registry configuration in the lab's containerd or the imagePullSecrets |
pods is forbidden: User "system:serviceaccount:jenkins-agents:jenkins" cannot create resource "pods" |
RBAC, or the k8s-jenkins-agents token has been revoked or rotated |
Check the Role/RoleBinding and the credential |
violates PodSecurity "baseline" |
The pod template requests something forbidden (privileges, hostPath) |
That is the protection working: fix the pod (08-02) |
Running but the agent does not connect |
The cloud's Jenkins URL is wrong as seen from the pod, or WebSocket is blocked | jnlp logs; test the URL from a debug pod |
OOMKilled in a container of the pod |
limits.memory too low for Maven and the tests |
Raise the limit or -XX:MaxRAMPercentage (08-02) |
- To debug, temporarily change Pod Retention to
On Failure: the failed pod stays around and you can inspect it. Set it back toNeverwhen you are done.
Secrets, Schedules and Waits: Credentials in the Log, cron, input and Quality Gate
Credentials Visible in the Log
- Symptom: a token or a password appears in plain text in the Console Output, or a transformed version of it.
- Causes: the
withCredentialsmasking replaces the exact value with****, but it does not recognize transformations: a secret encoded in Base64 or URL encoding, split into pieces, in another encoding, or printed by a tool in another format. Also:set -xbefore using the secret,envorprintenvinsidewithCredentials, Groovy interpolation insh(the warningA secret was passed to "sh" using Groovy String interpolation, 04-04), or a value that was not in a credential (a text parameter, anenvironmentvariable). - Solution: in this order, without waiting: (1) revoke and rotate the secret in the system that issued it: deleting it from the log does not un-expose it, because anyone could already have seen or copied it; (2) delete the affected builds (and remember that the backups also contain them); (3) fix the pipeline; (4) record the security incident.
- Prevention: the secrets rules from 04-04 and 04-07; credentials that the tool reads from a file or a variable without printing them; gitleaks also helps, in the code, not in the logs.
cron That Runs at an Unexpected Time
- Symptom: the
orders-apinightly build (H 2 * * 1-5) runs at 3:00 or at 1:00, or at a minute nobody chose. - Causes:
- Time zone: the controller container runs in UTC by default; without the
TZ=Europe/Madridline (02-03),2means 2:00 UTC, which in Madrid is 3:00 or 4:00 depending on daylight saving time. H: it is not a bug, it is the design:H 2 * * 1-5picks a minute that is fixed for that job (derived from its name) within hour 2, to spread the load. Two jobs withH 2run at different minutes. To narrow it down,H(0-14) 2 * * 1-5.- Clock changes: on the night the clocks change, an hour may not exist or may repeat; avoid scheduling critical tasks between 2:00 and 3:00 local time.
- The time you see: the interface shows times according to the time zone configured in your user profile, which may not be the controller's.
- Time zone: the controller container runs in UTC by default; without the
- Diagnosis: the help text under the schedule field (in the job configuration generated by the
Jenkinsfile) tells you when it last ran and when it will run next.
input That Blocks
- Symptom: executors busy for hours doing nothing; the queue grows while a build shows Paused for Input; or nobody can approve.
- Causes: an
inputas a step inside thestepsof a stage with an agent (it holds an executor while it waits); notimeout; inside alock(it holds on to the environment); or asubmitterwith names that do not correspond to real users or groups (for example, theproduction-approversgroup, which only exists once there is SSO). - Diagnosis: the build page shows which stage is waiting; Executor Status shows the executor held by that build.
- Solution: approve or abort the pending build to free the resource and, afterwards, rewrite the wait as the stage-level
inputdirective without an agent and with atimeout, outside anylock, as inorders-api-cd(07-03).
Quality Gate That Never Responds
- Symptom: the
Quality Gatestage waits until itstimeout(5 minutes at TecnoShop) and the build is aborted, even though the analysis finished in SonarQube. - Cause:
waitForQualityGatedoes not poll: it waits for SonarQube to notify Jenkins through the webhook to/sonarqube-webhook/(06-04). If the notification does not arrive or is not accepted, it waits until thetimeout. - Diagnosis: in SonarQube, Administration → Configuration → Webhooks (or in the project): the last delivery and its response. Typical errors: a Jenkins URL unreachable from SonarQube (in the lab, it must be
http://jenkins-controller:8080/sonarqube-webhook/, notlocalhost), a secret different fromsonar-webhook-secret, or the analysis was not run insidewithSonarQubeEnv('sonar-tecnoshop')(and so Jenkins does not know which task to wait for). - Solution: fix the URL or the secret and rerun the build (or Restart from Stage from
Quality analysis). - Prevention: the stage
timeoutlimits the damage; a periodic check of failed webhook deliveries catches it sooner.
TecnoShop's Incident Runbook
The catalog answers "what is going on?". The incident runbook answers "how do we organize ourselves while it is going on?". Laura keeps it in docs/runbooks/incidents.md in jenkins-config:
| Severity | Examples | Response |
|---|---|---|
| SEV1 | Jenkins down; the CD fails midway through a production deployment; a production secret exposed | Immediate, during and outside working hours; updates every 30 minutes |
| SEV2 | CI degraded for everyone (hours-long queue, agents down); webhooks down | Same day; updates at the start and at the end |
| SEV3 | One job or one branch with a problem; a warning alert | A task in the repository; handled by priority |
flowchart LR
D["Detect<br/>alert or report"] --> C["Communicate<br/>#ci-support: what, impact, who"]
C --> E["Stabilize<br/>mitigate before fixing"]
E --> G["Diagnose<br/>7-step method"]
G --> A["Fix<br/>minimal and reversible"]
A --> V["Verify and close<br/>announce the end"]
V --> P["Blameless review<br/>within 5 working days"]
- Detect: an alert from 05-05, the external check or a report from a team.
- Communicate: a message in
#ci-supportwith what is known (what is failing, who is affected, who is handling it). A single person owns the incident; if it is a SEV1, someone else takes care of communications. - Stabilize: mitigate the impact before looking for the cause: take an agent offline, pause the seed job, activate the deployment freeze with Reserve on
env-production(07-04), go back to the previous controller image. Before restarting, save the evidence: thread dumps, container logs, a support bundle. - Diagnose with the method from this lesson.
- Fix with a minimal change, through a PR if possible (with an urgent review) or by hand if not, carrying it over to the code the same day.
- Verify and close: check that the symptom has disappeared (a test build, the alert resolved) and announce that the incident is closed.
- Blameless review: brief minutes in
docs/minutes/with a timeline, cause, impact, what worked, what did not, and prevention actions with an owner and a date. The question is not "who made the mistake?" but "what allowed the mistake to reach production, and how do we catch it sooner?".
Common Mistakes and Tips
This time, the mistakes are not about configuration but about diagnosis:
- Restarting first and asking questions later: the restart may clear the symptom, but it wipes out the dumps, the queue state and the stuck threads that explained the cause. Save the evidence first.
- Changing several things at once: if you upgrade a plugin, raise the heap and restart the agent, and the problem goes away, you will not know what worked or what was unnecessary. One hypothesis at a time.
- Reading only the last line of the error: in Java, the real cause is usually further up, in the deepest
Caused by:of the stack trace; at Jenkins startup, in the first error. - Blaming Jenkins for what fails in the tool: if
./mvnw verifyfails the same way when run by hand on the agent, the problem lies with the project. Reproduce outside Jenkins before investigating inside it. - Diagnosing in production what can be reproduced in a test environment:
jenkins-testand alab-<topic>job exist for this. - Enabling
FINESTlogs and forgetting about them: they fill up the disk and slow down the controller. Disable log recorders when you are done. - Sharing a support bundle without reviewing it: it may contain server names and console fragments. Always review it before sending it outside.
- Disabling a protection "temporarily" without a plan to restore it: host verification, security, Pod Security. Temporary with no end date becomes permanent.
- Not writing down the prevention: if the incident is closed without a new alert, test or runbook, it will come back.
- Tip: keep a file in
docs/runbooks/for every problem that took you more than an hour. The second time it will take ten minutes, and the person on call will not have to phone you.
Exercises
Exercise 1. Cause and diagnose three problems in your lab, following the 7-step method and writing down each step: (a) on an orders-api branch, change the label of a stage to linux-docker; (b) stop the linux-agent-01 container during a catalog-web build; (c) change the SonarQube webhook secret in SonarQube and trigger a build of orders-api's main.
Exercise 2. On a Monday at 9:15, Diego reports in #ci-support that "Jenkins is incredibly slow": the interface takes 20 seconds to load and builds are slow to start. Describe, in order, what you would check, with which tools, and which evidence you would save before any restart. Propose three plausible hypotheses and how to confirm or rule out each one.
Exercise 3. After upgrading the controller image to a new LTS with updated plugins, Jenkins does not start and the log shows a JCasC error: No configurator for the following root elements: .... Write the sequence of actions (mitigation, diagnosis, solution and prevention) and draft the message Laura would post in #ci-support at the start.
Solutions
Solution 1. (a) Symptom: the branch build stays in the queue with There are no nodes with the label 'linux-docker'; layer: pipeline (only that branch); the hypothesis (a typo in the label) is confirmed in Nodes (nobody offers linux-docker); fix: linux && docker or the correct label; prevention: the label catalog in jenkins-config and the PR review. (b) Symptom: the build fails with ChannelClosedException or Agent went offline during the build, and the following ones wait with 'linux-agent-01' is offline; layer: agent; evidence: container and node logs; fix: start the agent and rerun; prevention: the offline nodes alert and, in the medium term, phase 1 of the scaling plan (moving catalog-web to pods). (c) Symptom: Quality Gate waits 5 minutes and aborts; layer: integration; diagnosis: the webhook delivery in SonarQube shows Jenkins rejecting it; fix: make the secret match sonar-webhook-secret and use Restart from Stage; prevention: periodic review of deliveries.
Solution 2. Order: (1) the "Jenkins - Health" dashboard: high heap after GC, sustained CPU, JENKINS_HOME disk, queue? (2) the queue by label through the API: are builds waiting for agents (a different problem from the interface one)? (3) two or three thread dumps 10 seconds apart; (4) the container logs for the last hour and docker inspect (restarts, OOM?); (5) what changed? (git log of jenkins-config and the library, weekend upgrades); (6) a support bundle. Evidence before restarting: the dumps, the container log, a screenshot of the dashboard and the bundle. Hypotheses: (a) the heap is at its limit after the weekend because of growing history or a plugin: confirmed if the heap floor after GC is above 85% and the dumps show GC threads or build-loading threads; (b) a burst of multibranch scans or API queries with depth (a new script): confirmed if the dumps show many Handling GET /.../api/json or branch indexing threads, and the access log or Audit Trail matches; (c) a slow or nearly full disk for JENKINS_HOME: confirmed with the I/O latency and du, and the dumps would show threads waiting on writes. Each one has a different mitigation, which is why you do not restart blindly.
Solution 3. Mitigation: go back to the previous image (the previous tag in docker-compose.yml, then recreate), and check that it starts and that builds work; if the new version had already modified files, restore the cold backup. Diagnosis: a root element with no configurator means that a plugin did not load (a dependency failed or it was renamed) or that a section changed its name; read the first error in the startup log, check the plugin's changelog to see whether its JCasC configuration changed, and start the candidate on jenkins-test to look at the JCasC documentation of that installation. Solution: fix plugins.txt or the YAML section in a PR. Prevention: the jenkins-config CI should have stopped this error (it looks for ConfiguratorException and SEVERE in the test startup); if it did not, add the exact pattern of the message and review why the candidate passed. Initial message: "SEV2 · The Jenkins controller does not start after the scheduled 8:00 upgrade. Impact: no builds or deployments are running. I'm on it (Laura). Current action: rolling back to the previous version; next update in 30 minutes or sooner."
Conclusion
Diagnosing well means following a method: describing the symptom precisely, reproducing it, narrowing down the layer (controller, agent, plugin, pipeline, network or tool), gathering evidence in the logs, testing one hypothesis at a time, applying a minimal and reversible fix, and writing down the prevention. The tools are at hand: System Log and log recorders at just the right level, the container and agent logs, repeated thread dumps, the Support Core support bundle reviewed before it is shared, and the Script Console for reading only. With them you have gone through the catalog of the most frequent problems on a platform like TecnoShop's, from the queue that does not move to the Quality Gate that never responds, including recovering administrator access, which disables protections and demands isolation and a record. The incident runbook organizes the response: communicate, stabilize, diagnose, fix and learn without blame. Many of these problems, especially the slowness ones, can be prevented before they appear by measuring and optimizing the controller, the pipelines and the builds, which is what you will do in Optimizing Jenkins Performance.
