Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NullPointerException from ComputeEngineComputerLauncher.launch #306

Open
jglick opened this issue Feb 7, 2022 · 0 comments
Open

NullPointerException from ComputeEngineComputerLauncher.launch #306

jglick opened this issue Feb 7, 2022 · 0 comments
Labels
bug Something isn't working

Comments

@jglick
Copy link
Member

jglick commented Feb 7, 2022

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 jenkinsci/workflow-durable-task-step-plugin#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

Operation operation =
cloud
.getClient()
.waitForOperationCompletion(
cloud.getProjectId(), insertOperationId, zone, node.getLaunchTimeoutMillis());
suggesting a failure in
private ComputeClient createClient() {
try {
ClientFactory clientFactory = ClientUtil.getClientFactory(Jenkins.get(), credentialsId);
return clientFactory.computeClient();
} catch (IOException e) {
log.log(Level.SEVERE, "Exception when creating GCE client", e);
// TODO: https://github.com/jenkinsci/google-compute-engine-plugin/issues/62
return null;
}
}
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

try {
GoogleRobotCredentials robotCreds =
getRobotCredentials(itemGroup, domainRequirements, credentialsId);
Credential googleCredential = getGoogleCredential(robotCreds);
clientFactory = new ClientFactory(transport, googleCredential, APPLICATION_NAME);
} catch (IOException | GeneralSecurityException ex) {
throw new AbortException(Messages.ClientFactory_FailedToInitializeHTTPTransport(ex));
}
Note that the AbortException here loses track of the nested IOException.

Anything else?

No response

@jglick jglick added the bug Something isn't working label Feb 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant