jenkinsci/google-storage-plugin

NullPointerException after upgrade to 1.3.0

Closed this issue · 21 comments

We are running jenkins-2.176.1-1.1.noarch on CentOS 7.4.1708. We have been running google-storage-plugin version 1.2 for a long time, and on Saturday our jenkins system updated this plugin to 1.3.0. After the upgrade of the plugin, all of our jobs that utilized this plugin were failing with the below NullPointerException message. After rolling back to 1.2, and restarting jenkins, the issue went away. I have not been able to pinpoint what exactly the cause is, so please let me know if/how I can help.

[Google Cloud Storage Plugin] Found 1 files to upload from pattern: **/target/application.jar
Error when executing success post condition:
java.lang.NullPointerException
	at com.google.jenkins.plugins.storage.AbstractUpload$2.<init>(AbstractUpload.java:438)
	at com.google.jenkins.plugins.storage.AbstractUpload.performUploads(AbstractUpload.java:435)
	at com.google.jenkins.plugins.storage.AbstractUpload.access$000(AbstractUpload.java:94)
	at com.google.jenkins.plugins.storage.AbstractUpload$1.call(AbstractUpload.java:387)
	at com.google.jenkins.plugins.storage.AbstractUpload$1.call(AbstractUpload.java:384)
	at hudson.remoting.UserRequest.perform(UserRequest.java:212)
	at hudson.remoting.UserRequest.perform(UserRequest.java:54)
	at hudson.remoting.Request$2.run(Request.java:369)
	at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)
	Suppressed: hudson.remoting.Channel$CallSiteStackTrace: Remote call to <BUILD_SLAVE_NAME_REDACTED>
		at hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1743)
		at hudson.remoting.UserRequest$ExceptionResponse.retrieve(UserRequest.java:357)
		at hudson.remoting.Channel.call(Channel.java:957)
		at hudson.FilePath.act(FilePath.java:1160)
		at com.google.jenkins.plugins.storage.AbstractUpload.initiateUploadsAtWorkspace(AbstractUpload.java:383)
		at com.google.jenkins.plugins.storage.AbstractUpload.perform(AbstractUpload.java:176)
		at com.google.jenkins.plugins.storage.ClassicUploadStep.perform(ClassicUploadStep.java:183)
		at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:80)
		at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:67)
		at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
		at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
		... 4 more

[Pipeline] End of Pipeline

Also:   hudson.remoting.Channel$CallSiteStackTrace: Remote call to <BUILD_SLAVE_NAME_REDACTED>
		at hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1743)
		at hudson.remoting.UserRequest$ExceptionResponse.retrieve(UserRequest.java:357)
		at hudson.remoting.Channel.call(Channel.java:957)
		at hudson.FilePath.act(FilePath.java:1160)
		at com.google.jenkins.plugins.storage.AbstractUpload.initiateUploadsAtWorkspace(AbstractUpload.java:383)
		at com.google.jenkins.plugins.storage.AbstractUpload.perform(AbstractUpload.java:176)
		at com.google.jenkins.plugins.storage.ClassicUploadStep.perform(ClassicUploadStep.java:183)
		at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:80)
		at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:67)
		at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
		at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
java.lang.NullPointerException
	at com.google.jenkins.plugins.storage.AbstractUpload$2.<init>(AbstractUpload.java:438)
	at com.google.jenkins.plugins.storage.AbstractUpload.performUploads(AbstractUpload.java:435)
	at com.google.jenkins.plugins.storage.AbstractUpload.access$000(AbstractUpload.java:94)
	at com.google.jenkins.plugins.storage.AbstractUpload$1.call(AbstractUpload.java:387)
	at com.google.jenkins.plugins.storage.AbstractUpload$1.call(AbstractUpload.java:384)
	at hudson.remoting.UserRequest.perform(UserRequest.java:212)
	at hudson.remoting.UserRequest.perform(UserRequest.java:54)
	at hudson.remoting.Request$2.run(Request.java:369)
	at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)
Finished: FAILURE

Hi @linux-samurai, thanks for bringing this to our attention. I'll be looking into this today and will let you know if I need more info to reproduce and fix the problem.

I was able to reproduce the issue. Not the same exact error message but I get the gist of what's happened now.

I tested creating a pipeline with the 1.2 build. My classic upload step was successful. Then I upgraded to 1.3.0 and ran it again, where it reproduced the NPE. Then I created a new pipeline with a classic upload step for version 1.3.0, and had no problems with the upload for this pipeline. However, when I reloaded the configuration from disk, I got the same NPE.

The issue is the UploadModule, which was made transient due to a security warning it caused. However, we also need to create a new UploadModule() if it is null, which is not done currently. Should have the fix out in a PR very soon after some more testing. From what I can tell now though, since the UploadModule did not store any critical information, users that upgraded to 1.3.0 will be able to upgrade to the next version (likely 1.3.1) without losing any configuration and have their builds working normally again.

Once again, thank you for bringing this to our attention.

Thanks @stephenashank for the quick response and reproduction. All of our configurations are 'in code', so should be good on a future upgrade. If you would like me to test, I can, albeit I may need some direction to test a non-released version (it has been a few years since I've done a manual plugin install). But once released, we can definitely update and test to provide quick feedback. Thanks in advance.

Thank you @linux-samurai, if you would like to test the unreleased build that would definitely be appreciated. I recommend building from source:

First clone the repository

git clone git@github.com:jenkinsci/google-storage-plugin.git && cd google-storage-plugin

That should put you on the develop branch by default. Then, to get the code from the PR in your directory, run this:

git fetch origin pull/79/head:pr-79 && git checkout pr-79

Finally, assuming you have java 8 and maven installed, you can run

mvn compile hpi:hpi

This will create target/google-storage-plugin.hpi in your current directory. From the jenkins UI, you can go to Manage Jenkins then Manage Plugins. Under the Advanced tab you can use the Upload Plugin dialog to upload the file you generated. You'll need to then restart Jenkins for the installation to take effect.

Let me know if you have any questions and thanks for offering to test this out. I would prefer not to have another release with a bug and the more coverage the better.

Just as an addendum: I’ve started seeing NPEs after upgrading to 1.3 as well, but my stacktrace is different:

ERROR: Build step failed with exception
java.lang.NullPointerException
	at com.google.jenkins.plugins.storage.ClassicUpload.getInclusions(ClassicUpload.java:103)
	at com.google.jenkins.plugins.storage.AbstractUpload.perform(AbstractUpload.java:170)
	at com.google.jenkins.plugins.storage.ClassicUploadStep.perform(ClassicUploadStep.java:183)
	at hudson.tasks.BuildStepCompatibilityLayer.perform(BuildStepCompatibilityLayer.java:79)
	at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
	at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:741)
	at hudson.model.Build$BuildExecution.build(Build.java:206)
	at hudson.model.Build$BuildExecution.doRun(Build.java:163)
	at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:504)
	at hudson.model.Run.execute(Run.java:1818)
	at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
	at hudson.model.ResourceController.execute(ResourceController.java:97)
	at hudson.model.Executor.run(Executor.java:429)
Build step 'Google Storage Classic Upload' marked build as failure

Let me know if you have any questions and thanks for offering to test this out. I would prefer not to have another release with a bug and the more coverage the better.

I tried your fix and now it works again. Thank you!

@PattaFeuFeu Thank you for confirming that

@PattaFeuFeu @linux-samurai I've released 1.3.1 with this fix incorporated, and it's currently live in the update center, so check it out when you get a chance.

Still works! One happy camper. 👍

Issue can be closed from my side.

I am having this same error with v1.3.1:

Also:   hudson.remoting.Channel$CallSiteStackTrace: Remote call to JNLP4-connect connection from ***********
		at hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1743)
		at hudson.remoting.UserRequest$ExceptionResponse.retrieve(UserRequest.java:357)
		at hudson.remoting.Channel.call(Channel.java:957)
		at hudson.FilePath.act(FilePath.java:1160)
		at com.google.jenkins.plugins.storage.AbstractUpload.initiateUploadsAtWorkspace(AbstractUpload.java:390)
		at com.google.jenkins.plugins.storage.AbstractUpload.perform(AbstractUpload.java:176)
		at com.google.jenkins.plugins.storage.ClassicUploadStep.perform(ClassicUploadStep.java:183)
		at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:80)
		at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:67)
		at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
		at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
		at java.util.concurrent.FutureTask.run(FutureTask.java:266)
		at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
		at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
java.lang.NullPointerException
	at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:187)
	at com.google.jenkins.plugins.storage.AbstractUpload.getDescriptor(AbstractUpload.java:365)
	at com.google.jenkins.plugins.storage.AbstractUpload.getModule(AbstractUpload.java:276)
	at com.google.jenkins.plugins.storage.AbstractUpload$2.<init>(AbstractUpload.java:445)
	at com.google.jenkins.plugins.storage.AbstractUpload.performUploads(AbstractUpload.java:442)
	at com.google.jenkins.plugins.storage.AbstractUpload.access$000(AbstractUpload.java:94)
	at com.google.jenkins.plugins.storage.AbstractUpload$1.call(AbstractUpload.java:394)
	at com.google.jenkins.plugins.storage.AbstractUpload$1.call(AbstractUpload.java:391)
	at hudson.remoting.UserRequest.perform(UserRequest.java:212)
	at hudson.remoting.UserRequest.perform(UserRequest.java:54)
	at hudson.remoting.Request$2.run(Request.java:369)
	at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at hudson.remoting.Engine$1.lambda$newThread$0(Engine.java:93)
	at java.lang.Thread.run(Thread.java:748)

Hi @guillem-sopra, which version of Jenkins are you using?

@guillem-sopra If you'd like you can test the fix I have for this by following the instructions I gave in the comment above, replacing 79 with 83: #78 (comment). Let me know if you experience any other issues.

Hello folks, wanted to check on this and see whether or not this has been resolved when using 3.3.2. Please let us know, thanks.

@stephenashank

I tested 1.3.1 and confirmed it too was broken. So I pulled down pr-83, built, and tested, and our setup is working successfully! We are on jenkins-2.176.1-1.1.noarch, CentOS 7.4.1708.

image_20190708_230119

I am on v2.176.1
Downgraded to 1.2 and working well again.

I've built the pr and uplodaded the plugin. Once I am able to reboot jenkins, I'll test it.

It fails with the same error:

Also:   hudson.remoting.Channel$CallSiteStackTrace: Remote call to JNLP4-connect connection from ******
		at hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1743)
		at hudson.remoting.UserRequest$ExceptionResponse.retrieve(UserRequest.java:357)
		at hudson.remoting.Channel.call(Channel.java:957)
		at hudson.FilePath.act(FilePath.java:1160)
		at com.google.jenkins.plugins.storage.AbstractUpload.initiateUploadsAtWorkspace(AbstractUpload.java:390)
		at com.google.jenkins.plugins.storage.AbstractUpload.perform(AbstractUpload.java:176)
		at com.google.jenkins.plugins.storage.ClassicUploadStep.perform(ClassicUploadStep.java:183)
		at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:80)
		at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:67)
		at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
		at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
		at java.util.concurrent.FutureTask.run(FutureTask.java:266)
		at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
		at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
java.lang.NullPointerException
	at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:187)
	at com.google.jenkins.plugins.storage.AbstractUpload.getDescriptor(AbstractUpload.java:365)
	at com.google.jenkins.plugins.storage.AbstractUpload.getModule(AbstractUpload.java:276)
	at com.google.jenkins.plugins.storage.AbstractUpload$2.<init>(AbstractUpload.java:445)
	at com.google.jenkins.plugins.storage.AbstractUpload.performUploads(AbstractUpload.java:442)
	at com.google.jenkins.plugins.storage.AbstractUpload.access$000(AbstractUpload.java:94)
	at com.google.jenkins.plugins.storage.AbstractUpload$1.call(AbstractUpload.java:394)
	at com.google.jenkins.plugins.storage.AbstractUpload$1.call(AbstractUpload.java:391)
	at hudson.remoting.UserRequest.perform(UserRequest.java:212)
	at hudson.remoting.UserRequest.perform(UserRequest.java:54)
	at hudson.remoting.Request$2.run(Request.java:369)
	at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at hudson.remoting.Engine$1.lambda$newThread$0(Engine.java:93)
	at java.lang.Thread.run(Thread.java:748)

1.3.2 has been released. Please try upgrading to this version and see if the problem has been addressed.

Not available yet 😢

java.io.FileNotFoundException: http://archives.jenkins-ci.org/plugins/google-storage-plugin/1.3.2/google-storage-plugin.hpi

It takes a few hours for Artifactory to propagate. I'd suggest trying tomorrow :)

Version 1.3.2 is working well. Thank you.

Awesome. Happy to hear it!