-
Notifications
You must be signed in to change notification settings - Fork 126
Open
Description
This is with an hpi build from the commit b2be679 manually installed into a jenkins docker container.
The initial build comment is successfully posted, but fails to be deleted once the workflow job completes. I've traced this to the following scenario:
- StashPullRequestBuilder run is invoked
- StashRepository init is invoked followed by all methods to check if build should be triggered
- StashRepository recognizes build should be triggered, posts "build started" comment
- StashBuilds onStarted is invoked
- StashRespository client (StashApiClient) is finalized
- WorkflowRun finish is invoked with SUCCESS result
- StashBuilds onCompleted is invoked
- StashRespository tries to delete "build started" comment, but StashRespository client has already been finalized and so is null
I'm confused as to why StashRespository.client gets finalized before the StashRespository object itself is finalized. I see nowhere where StashRespository is getting set to null, so StashRespository should still have a reference to the client created in the StashRepository.init method, should it not?
I was able to fix this by simply always allocating a new StashApiClient when needed. This is inefficient so I'd much rather understand why the StashApiClient is being garbage collected so soon.
Dec 20, 2017 4:41:01 AM stashpullrequestbuilder.stashpullrequestbuilder.StashRepository isBuildTarget
INFO: Building PR: 1
Dec 20, 2017 4:41:01 AM stashpullrequestbuilder.stashpullrequestbuilder.StashRepository addFutureBuildTasks
INFO: TETO-test-PR client: stashpullrequestbuilder.stashpullrequestbuilder.stash.StashApiClient@613d0a49
Dec 20, 2017 4:41:01 AM stashpullrequestbuilder.stashpullrequestbuilder.StashRepository getAdditionalParameters
INFO: TETO-test-PR client: stashpullrequestbuilder.stashpullrequestbuilder.stash.StashApiClient@613d0a49
Dec 20, 2017 4:41:01 AM stashpullrequestbuilder.stashpullrequestbuilder.StashRepository postBuildStartCommentTo
INFO: TETO-test-PR client: stashpullrequestbuilder.stashpullrequestbuilder.stash.StashApiClient@613d0a49
Dec 20, 2017 4:41:02 AM stashpullrequestbuilder.stashpullrequestbuilder.StashBuildListener onStarted
INFO: BuildListener onStarted called.
Dec 20, 2017 4:41:02 AM stashpullrequestbuilder.stashpullrequestbuilder.StashBuilds onStarted
INFO: client: stashpullrequestbuilder.stashpullrequestbuilder.stash.StashApiClient@613d0a49
Dec 20, 2017 4:41:07 AM stashpullrequestbuilder.stashpullrequestbuilder.stash.StashApiClient finalize
INFO: StashApiClient finalize
Dec 20, 2017 4:41:13 AM org.jenkinsci.plugins.workflow.job.WorkflowRun finish
INFO: TETO-test-PR #14 completed: SUCCESS
Dec 20, 2017 4:41:13 AM stashpullrequestbuilder.stashpullrequestbuilder.StashBuilds onCompleted
INFO: client: null
Dec 20, 2017 4:41:13 AM stashpullrequestbuilder.stashpullrequestbuilder.StashRepository deletePullRequestComment
INFO: TETO-test-PR pullRequestId: 1, commentId: 689695
Dec 20, 2017 4:41:13 AM stashpullrequestbuilder.stashpullrequestbuilder.StashRepository deletePullRequestComment
INFO: TETO-test-PR this.client: null
Dec 20, 2017 4:41:13 AM stashpullrequestbuilder.stashpullrequestbuilder.StashRepository deletePullRequestComment
INFO: TETO-test-PR client: null
Dec 20, 2017 4:41:13 AM hudson.model.listeners.RunListener report
WARNING: RunListener failed
java.lang.NullPointerException
at stashpullrequestbuilder.stashpullrequestbuilder.StashRepository.deletePullRequestComment(StashRepository.java:186)
at stashpullrequestbuilder.stashpullrequestbuilder.StashBuilds.onCompleted(StashBuilds.java:63)
at stashpullrequestbuilder.stashpullrequestbuilder.StashBuildListener.onCompleted(StashBuildListener.java:34)
at hudson.model.listeners.RunListener.fireCompleted(RunListener.java:211)
at org.jenkinsci.plugins.workflow.job.WorkflowRun.finish(WorkflowRun.java:664)
...
sundski
Metadata
Metadata
Assignees
Labels
No labels