[JIRA] (JENKINS-58311) NotSerializableException when uploading apk with appcenter-plugin

245 views
Skip to first unread message

peteroost@sirrah.nl (JIRA)

unread,
Jul 3, 2019, 3:47:02 AM7/3/19
to jenkinsc...@googlegroups.com
Peter Oost created an issue
 
Jenkins / Bug JENKINS-58311
NotSerializableException when uploading apk with appcenter-plugin
Issue Type: Bug Bug
Assignee: Mez Pahlan
Components: appcenter-plugin
Created: 2019-07-03 07:46
Environment: Jenkins ver. 2.164.3
appcenter-plugin ver. 0.1.0 (installed without having rebooted Jenkins yet)
Priority: Minor Minor
Reporter: Peter Oost

I've added the appcenter-plugin to my clients' Jenkins configuration and added a Pipeline stage to build and publish `MyApp` to the AppCenter:
```
stage('Publish MyApp') {
agent

{ label 'Java' }

environment

{ APPCENTER_API_TOKEN = credentials('appcenter-api-token') }

steps

{ checkout scm preparePropertiesFile() sh """ ./gradlew clean \ :tester.android:assembleRelease """ appCenter apiToken: env.APPCENTER_API_TOKEN, ownerName: 'Me', appName: 'MyApp', pathToApp: 'my_app/build/outputs/apk/release/my_app-release-unsigned.apk' }

}
```
The app builds fine but I receive a `NotSerializableException` within the `UploadTask` of the appcenter-plugin:
```
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // withCredentials
[Pipeline] End of Pipeline
java.io.NotSerializableException: retrofit2.Retrofit$1
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1184)
at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1548)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1509)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1432)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1178)
at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1548)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1509)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1432)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1178)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:348)
at hudson.remoting.UserRequest._serialize(UserRequest.java:264)
at hudson.remoting.UserRequest.serialize(UserRequest.java:273)
Caused: java.io.IOException: Unable to serialize io.jenkins.plugins.appcenter.task.UploadTask@452eeea
at hudson.remoting.UserRequest.serialize(UserRequest.java:275)
at hudson.remoting.UserRequest.<init>(UserRequest.java:101)
at hudson.remoting.Channel.call(Channel.java:955)
at hudson.FilePath.act(FilePath.java:1159)
at io.jenkins.plugins.appcenter.AppCenterRecorder.uploadToAppCenter(AppCenterRecorder.java:104)
at io.jenkins.plugins.appcenter.AppCenterRecorder.perform(AppCenterRecorder.java:92)
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)
at java.lang.Thread.run(Thread.java:748)
Finished: FAILURE
```

Add Comment Add Comment
 
This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d)

peteroost@sirrah.nl (JIRA)

unread,
Jul 3, 2019, 3:50:02 AM7/3/19
to jenkinsc...@googlegroups.com
Peter Oost updated an issue
Change By: Peter Oost
I've added the appcenter-plugin to my clients' Jenkins configuration and added a Pipeline stage to build and publish `MyApp` to the AppCenter:
```
{code:groovy}
        stage('Publish MyApp') {
            agent {
                label 'Java'
            }
            environment {
                APPCENTER_API_TOKEN = credentials('appcenter-api-token')
            }
            steps {
                checkout scm
                preparePropertiesFile()
                sh """
                    ./gradlew clean \
                    :tester.android:assembleRelease
                """

                appCenter apiToken: env.APPCENTER_API_TOKEN,
                     ownerName: 'Me',
                     appName: 'MyApp',
                     pathToApp: 'my_app/build/outputs/apk/release/my_app-release-unsigned.apk'
            }
        }
``` {code}

The app builds fine but I receive a `NotSerializableException` within the `UploadTask` of the appcenter-plugin:
```
{code}
``` {code}

peteroost@sirrah.nl (JIRA)

unread,
Jul 3, 2019, 6:54:03 AM7/3/19
to jenkinsc...@googlegroups.com
Peter Oost commented on Bug JENKINS-58311
 
Re: NotSerializableException when uploading apk with appcenter-plugin

I had verified that the `pathToApp` is correct and the apk exists. Just now I ran another test with an incorrect filename. That results in the same NotSerializableException.

Am I completely misinterpreting the plugin configuration?

 

mez.pahlan@gmail.com (JIRA)

unread,
Jul 3, 2019, 1:59:02 PM7/3/19
to jenkinsc...@googlegroups.com

Hi Peter Oost thank you for being an early tester for this plugin. I'm not immediately sure why this is happening so will have to take a deeper look into it. I'll update this issue with my findings.

Could you let me know your Jenkins setup in the mean time? Single Master or Master + Slave nodes? And are you running Linux / Mac / Windows on these.

Many thanks.

mez.pahlan@gmail.com (JIRA)

unread,
Jul 3, 2019, 2:01:02 PM7/3/19
to jenkinsc...@googlegroups.com
Mez Pahlan started work on Bug JENKINS-58311
 
Change By: Mez Pahlan
Status: Open In Progress

lazauskas.algimantas@gmail.com (JIRA)

unread,
Jul 4, 2019, 4:21:03 AM7/4/19
to jenkinsc...@googlegroups.com

peteroost@sirrah.nl (JIRA)

unread,
Jul 4, 2019, 5:00:02 AM7/4/19
to jenkinsc...@googlegroups.com

Mez Pahlan Thanks for taking the time to look at this.

This setup has a master and multiple slaves, all running Linux (there is also a Mac OS slave but that's not building this project).

mez.pahlan@gmail.com (JIRA)

unread,
Jul 4, 2019, 5:32:02 AM7/4/19
to jenkinsc...@googlegroups.com

It seems to be something with the fact that a master slave setup is being used. This is definitely a hug in the plugin. I need to find a way to pass the details of the build from the master to the slave. Specifically Retrofit.

mez.pahlan@gmail.com (JIRA)

unread,
Jul 4, 2019, 5:33:02 AM7/4/19
to jenkinsc...@googlegroups.com

peteroost@sirrah.nl (JIRA)

unread,
Jul 4, 2019, 6:02:03 AM7/4/19
to jenkinsc...@googlegroups.com
Peter Oost commented on Bug JENKINS-58311
 
Re: NotSerializableException when uploading apk with appcenter-plugin

It's not limited to the plugin though. I wrote a script that uses curl to access the AppCenter API directly and it receives the same exception during the second API call (uploading the apk).

The script build step:

script {
def apiToken = '<api-token>'
def ownerName = 'Me'
def appName = 'MyApp'
def apkFilename = 'myApp/build/outputs/apk/release/myApp-release-unsigned.apk'
​
echo "Preparing a release on AppCenter"
def rawResponse1 = sh(script: "curl -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' --header 'X-API-Token: $apiToken' 'https://api.appcenter.ms/v0.1/apps/$ownerName/$appName/release_uploads'", returnStdout: true)
echo "Raw response 1 : '${rawResponse1}'"def slurper = new groovy.json.JsonSlurper()
def response1 = slurper.parseText("${rawResponse1}")
echo "Parsed response 1: ${response1}"
​
echo "Uploading apk file to AppCenter"
def rawResponse2 = sh(script: "curl -F 'ipa=@{apkFilename}' '${response1.upload_url}", returnStdout: true)
echo "Raw response 2 : '${rawResponse2}'"
​
echo "Release uploaded apk on AppCenter"
def rawResponse3 = sh(script: "curl -X PATCH --header 'Content-Type: application/json' --header 'Accept: application/json' --header 'X-API-Token: ${apiToken}' -d '{ \"status\": \"committed\" }' 'https://api.appcenter.ms/v0.1/apps/$ownerName/$appName/release_uploads/${response1.upload_id}'", returnStdout: true)
echo "Raw response 3 : '${rawResponse3}'"
def response3 = slurper.parseText("${rawResponse3}")
​
echo "Distributing release to testers"
def rawResponse4 = sh(script: "curl -X PATCH --header 'Content-Type: application/json' --header 'Accept: application/json' --header 'X-API-Token: ${apiToken}' -d '{ \"destination_name\": \"Internal test group\", \"release_notes\": \"Automated build\" }' 'https://api.appcenter.ms/${response3.release_url}'", returnStdout: true)
echo "Raw response 4 : '${rawResponse4}'"
}

and the exception:

an exception which occurred:
	in field com.cloudbees.groovy.cps.impl.BlockScopeEnv.locals
	in object com.cloudbees.groovy.cps.impl.BlockScopeEnv@42294e4a
	in field com.cloudbees.groovy.cps.impl.CallEnv.caller
	in object com.cloudbees.groovy.cps.impl.FunctionCallEnv@6107f29
	in field com.cloudbees.groovy.cps.Continuable.e
	in object org.jenkinsci.plugins.workflow.cps.SandboxContinuable@4ce96240
	in field org.jenkinsci.plugins.workflow.cps.CpsThread.program
	in object org.jenkinsci.plugins.workflow.cps.CpsThread@37cfbea8
	in field org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.threads
	in object org.jenkinsci.plugins.workflow.cps.CpsThreadGroup@55a85c71
	in object org.jenkinsci.plugins.workflow.cps.CpsThreadGroup@55a85c71
Caused: java.io.NotSerializableException: groovy.json.JsonSlurper
	at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:926)
	at org.jboss.marshalling.river.BlockMarshaller.doWriteObject(BlockMarshaller.java:65)
	at org.jboss.marshalling.river.BlockMarshaller.writeObject(BlockMarshaller.java:56)
	at org.jboss.marshalling.MarshallerObjectOutputStream.writeObjectOverride(MarshallerObjectOutputStream.java:50)
	at org.jboss.marshalling.river.RiverObjectOutputStream.writeObjectOverride(RiverObjectOutputStream.java:179)
	at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:344)
	at java.util.HashMap.internalWriteEntries(HashMap.java:1790)
	at java.util.HashMap.writeObject(HashMap.java:1363)
	at sun.reflect.GeneratedMethodAccessor26.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.jboss.marshalling.reflect.JDKSpecific$SerMethods.callWriteObject(JDKSpecific.java:156)
	at org.jboss.marshalling.reflect.SerializableClass.callWriteObject(SerializableClass.java:191)
	at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1028)
	at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:920)
	at org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1082)
	at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1040)
	at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:920)
	at org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1082)
	at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1040)
	at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1019)
	at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:920)
	at org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1082)
	at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1040)
	at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1019)
	at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:920)
	at org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1082)
	at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1040)
	at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:920)
	at org.jboss.marshalling.river.BlockMarshaller.doWriteObject(BlockMarshaller.java:65)
	at org.jboss.marshalling.river.BlockMarshaller.writeObject(BlockMarshaller.java:56)
	at org.jboss.marshalling.MarshallerObjectOutputStream.writeObjectOverride(MarshallerObjectOutputStream.java:50)
	at org.jboss.marshalling.river.RiverObjectOutputStream.writeObjectOverride(RiverObjectOutputStream.java:179)
	at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:344)
	at java.util.concurrent.ConcurrentSkipListMap.writeObject(ConcurrentSkipListMap.java:1437)
	at sun.reflect.GeneratedMethodAccessor193.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.jboss.marshalling.reflect.JDKSpecific$SerMethods.callWriteObject(JDKSpecific.java:156)
	at org.jboss.marshalling.reflect.SerializableClass.callWriteObject(SerializableClass.java:191)
	at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1028)
	at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:920)
	at org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1082)
	at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1040)
	at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:920)
	at org.jboss.marshalling.AbstractObjectOutput.writeObject(AbstractObjectOutput.java:58)
	at org.jboss.marshalling.AbstractMarshaller.writeObject(AbstractMarshaller.java:111)
	at org.jenkinsci.plugins.workflow.support.pickles.serialization.RiverWriter.lambda$writeObject$0(RiverWriter.java:144)
	at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.GroovySandbox.runInSandbox(GroovySandbox.java:241)
	at org.jenkinsci.plugins.workflow.support.pickles.serialization.RiverWriter.writeObject(RiverWriter.java:143)
	at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.saveProgram(CpsThreadGroup.java:523)
	at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.saveProgram(CpsThreadGroup.java:499)
	at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.saveProgramIfPossible(CpsThreadGroup.java:486)
	at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.run(CpsThreadGroup.java:410)
	at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.access$200(CpsThreadGroup.java:93)
	at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:282)
	at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:270)
	at org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService$2.call(CpsVmExecutorService.java:64)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at hudson.remoting.SingleLaneExecutorService$1.run(SingleLaneExecutorService.java:131)
	at jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28)
	at jenkins.security.ImpersonatingExecutorService$1.run(ImpersonatingExecutorService.java:59)
	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)
	at java.lang.Thread.run(Thread.java:748)
Finished: FAILURE

mez.pahlan@gmail.com (JIRA)

unread,
Jul 6, 2019, 11:09:02 AM7/6/19
to jenkinsc...@googlegroups.com

I'm not sure about that recent stack trace you posted. At the moment I don't think it is related.

Whilst developing this plugin I only had access to a single node instance of Jenkins. So my quick tests worked. I should have tested this with more than one node and in particular doing some work on node A and continuing on node B. This is what your first stack trace suggests to me is happening.

Good news is that I have been able to recreate your stack trace locally now! So there's a better change that I can fix this for you.

I'll keep you posted!

mez.pahlan@gmail.com (JIRA)

unread,
Jul 6, 2019, 4:31:02 PM7/6/19
to jenkinsc...@googlegroups.com

mez.pahlan@gmail.com (JIRA)

unread,
Jul 7, 2019, 5:31:03 AM7/7/19
to jenkinsc...@googlegroups.com
 
Re: NotSerializableException when uploading apk with appcenter-plugin

Hi Peter OostI think I've fixed this to work in a master-slave environment. Could you give this a go and comment on the PR (https://github.com/jenkinsci/appcenter-plugin/pull/7) if you are happy with the fix? You should be able to get the PR aretefacts from https://ci.jenkins.io/job/Plugins/job/appcenter-plugin/view/change-requests/job/PR-7/

mez.pahlan@gmail.com (JIRA)

unread,
Jul 8, 2019, 2:01:02 PM7/8/19
to jenkinsc...@googlegroups.com

mez.pahlan@gmail.com (JIRA)

unread,
Jul 8, 2019, 2:02:02 PM7/8/19
to jenkinsc...@googlegroups.com

mez.pahlan@gmail.com (JIRA)

unread,
Jul 8, 2019, 3:12:02 PM7/8/19
to jenkinsc...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages