jenkinsci / jenkinsci/google-compute-engine-plugin

`NullPointerException` from `ComputeEngineComputerLauncher.launch`

Open
#306 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Java
Stars
58
Forks
97
PR merge metrics
No merged PRs in 30d

Description

### Jenkins and plugins versions report

Environment

Jenkins 2.319.3 (CloudBees CI variant), `google-compute-engine` 4.3.8

### What Operating System are you using (both controller, and any agents involved in the problem)?

Linux

### Reproduction steps

Unknown exactly. Jenkins was upgraded while a Pipeline build was running that used a GCE agent. After restart, the build tried to resume but failed, perhaps because the agent VM had been killed. While normally there is a 5m timeout waiting for the agent to reconnect before Pipeline infrastructure gives up and fails (pending https://github.com/jenkinsci/workflow-durable-task-step-plugin/pull/180), in this case the build seemed to keep on trying to resume longer than that. I went to `https://jenkins/computer/gce-cloud-…/log` and saw an error.

### Expected Results

No exceptions, perhaps just an error message saying that the VM could not be relaunched.

### Actual Results

```
java.lang.NullPointerException
at com.google.jenkins.plugins.computeengine.ComputeEngineComputerLauncher.launch(ComputeEngineComputerLauncher.java:157)
at hudson.slaves.SlaveComputer.lambda$_connect$0(SlaveComputer.java:293)
at …
```

which corresponds to https://github.com/jenkinsci/google-compute-engine-plugin/blob/9dfd5b735fb4164e3513110a3013a8b20a88df51/src/main/java/com/google/jenkins/plugins/computeengine/ComputeEngineComputerLauncher.java#L154-L158 suggesting a failure in https://github.com/jenkinsci/google-compute-engine-plugin/blob/9dfd5b735fb4164e3513110a3013a8b20a88df51/src/main/java/com/google/jenkins/plugins/computeengine/ComputeEngineCloud.java#L188-L197 or #62. Looking for that message in log files, I see

```
SEVERE c.g.j.p.c.ComputeEngineCloud#createClient: Exception when creating GCE client
hudson.AbortException: Failed to initialize HTTP transport: hudson.AbortException: Could not retrieve credentials: …
at com.google.jenkins.plugins.computeengine.client.ClientUtil.getClientFactory(ClientUtil.java:56)
at com.google.jenkins.plugins.computeengine.client.ClientUtil.getClientFactory(ClientUtil.java:71)
at com.google.jenkins.plugins.computeengine.ComputeEngineCloud.createClient(ComputeEngineCloud.java:190)
at com.google.jenkins.plugins.computeengine.ComputeEngineCloud.getClient(ComputeEngineCloud.java:208)
at com.google.jenkins.plugins.computeengine.ComputeEngineComputerLauncher.launch(ComputeEngineComputerLauncher.java:156)
at hudson.slaves.SlaveComputer.lambda$_connect$0(SlaveComputer.java:293)
at …
```

pointing to https://github.com/jenkinsci/google-compute-engine-plugin/blob/9dfd5b735fb4164e3513110a3013a8b20a88df51/src/main/java/com/google/jenkins/plugins/computeengine/client/ClientUtil.java#L50-L57 Note that the `AbortException` here loses track of the nested `IOException`.

### Anything else?

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.