[JIRA] [p4-plugin] (JENKINS-30525) P4 plugin doesn't detect failure and can then cause other plugins to fail

2 views
Skip to first unread message

morne.joubert@u-blox.com (JIRA)

unread,
Sep 17, 2015, 12:20:02 PM9/17/15
to jenkinsc...@googlegroups.com
Morne Joubert created an issue
 
Jenkins / Bug JENKINS-30525
P4 plugin doesn't detect failure and can then cause other plugins to fail
Issue Type: Bug Bug
Assignee: Unassigned
Components: p4-plugin
Created: 17/Sep/15 4:19 PM
Priority: Major Major
Reporter: Morne Joubert

Sore error conditions are not detected and then puts the job in a certain state that causes other plugins that don't have good error checking to fail.
(This is related to JENKINS-30466)

e.g.
P4 Task: syncing files at change: 142720
... p4 sync c:\jenkins\workspace__atf_int_mlb_0/...@142720
+
duration: (519ms)

P4 Task: unshelve review: 142711
... p4 unshelve -f -s142711 -cdefault
+
... p4 revert -k c:\jenkins\workspace__atf_int_mlb_0/...
+
... duration: (35ms)
P4 Task: saving built changes.
... p4 client -o __atf_int_mlb_0_jenkins_p4_2_mlb-TEST-gb-mlb-dt-018 +
... p4 change -o 142711 +
Unable to get changes: com.perforce.p4java.exception.RequestException: Change 142711 unknown.

... p4 client -o __atf_int_mlb_0_jenkins_p4_2_mlb-TEST-gb-mlb-dt-018 +
... p4 change -o 142711 +
Unable to get changes: com.perforce.p4java.exception.RequestException: Change 142711 unknown.

... done

Maybe the user has deleted the shelved changes or even deleted the cl, or if the shelved cl is on a stream where it can't be handled.

Anyway, the plugin is not in a bad state, it doesn't inform the job so the normal builds steps go.

When the plugin is in this state the job fails at the end with the following:
FATAL: null
java.lang.NullPointerException
Collecting metadata...
Metadata collection done.
Finished: FAILURE

The Jenkins log show the following:
Sep 16, 2015 9:43:32 AM org.apache.commons.jelly.expression.jexl.JexlExpression evaluate
WARNING: Caught exception evaluating: cs.affectedFiles. Reason: java.lang.reflect.InvocationTargetException
java.lang.reflect.InvocationTargetException
at sun.reflect.GeneratedMethodAccessor688.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.apache.commons.jexl.util.PropertyExecutor.execute(PropertyExecutor.java:125)
at org.apache.commons.jexl.util.introspection.UberspectImpl$VelGetterImpl.invoke(UberspectImpl.java:314)
at org.apache.commons.jexl.parser.ASTArrayAccess.evaluateExpr(ASTArrayAccess.java:185)
at org.apache.commons.jexl.parser.ASTIdentifier.execute(ASTIdentifier.java:75)
at org.apache.commons.jexl.parser.ASTReference.execute(ASTReference.java:83)
at org.apache.commons.jexl.parser.ASTReference.value(ASTReference.java:57)
at org.apache.commons.jexl.parser.ASTReferenceExpression.value(ASTReferenceExpression.java:51)
at org.apache.commons.jexl.ExpressionImpl.evaluate(ExpressionImpl.java:80)
at org.apache.commons.jelly.expression.jexl.JexlExpression.evaluate(JexlExpression.java:69)
at org.apache.commons.jelly.expression.jexl.JexlExpressionFactory$ExpressionSupportLocal.evaluate(JexlExpressionFactory.java:122)
at org.apache.commons.jelly.expression.ExpressionSupport.evaluateRecurse(ExpressionSupport.java:61)
at org.apache.commons.jelly.expression.ExpressionSupport.evaluateAsIterator(ExpressionSupport.java:94)
at org.apache.commons.jelly.tags.core.ForEachTag.doTag(ForEachTag.java:89)
at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:269)
at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:95)
at org.apache.commons.jelly.TagSupport.invokeBody(TagSupport.java:161)
at org.apache.commons.jelly.tags.core.ForEachTag.doTag(ForEachTag.java:150)
at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:269)
at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:95)
at org.apache.commons.jelly.TagSupport.invokeBody(TagSupport.java:161)
at org.apache.commons.jelly.impl.StaticTag.doTag(StaticTag.java:65)
at org.apache.commons.jelly.impl.StaticTagScript.run(StaticTagScript.java:124)
at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:95)
at org.apache.commons.jelly.tags.core.CoreTagLibrary$1.run(CoreTagLibrary.java:98)
at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:95)
at org.apache.commons.jelly.TagSupport.invokeBody(TagSupport.java:161)
at org.apache.commons.jelly.impl.StaticTag.doTag(StaticTag.java:65)
at org.apache.commons.jelly.impl.StaticTagScript.run(StaticTagScript.java:124)
at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:95)
at org.apache.commons.jelly.tags.core.CoreTagLibrary$2.run(CoreTagLibrary.java:105)
at hudson.plugins.emailext.plugins.content.JellyScriptContent.convert(JellyScriptContent.java:158)
at hudson.plugins.emailext.plugins.content.JellyScriptContent.renderContent(JellyScriptContent.java:149)
at hudson.plugins.emailext.plugins.content.JellyScriptContent.evaluate(JellyScriptContent.java:58)
at org.jenkinsci.plugins.tokenmacro.DataBoundTokenMacro.evaluate(DataBoundTokenMacro.java:189)
at org.jenkinsci.plugins.tokenmacro.TokenMacro.expand(TokenMacro.java:182)
at org.jenkinsci.plugins.tokenmacro.TokenMacro.expandAll(TokenMacro.java:233)
at hudson.plugins.emailext.plugins.ContentBuilder.transformText(ContentBuilder.java:72)
at hudson.plugins.emailext.ExtendedEmailPublisher.getContent(ExtendedEmailPublisher.java:659)
at hudson.plugins.emailext.ExtendedEmailPublisher.createMail(ExtendedEmailPublisher.java:538)
at hudson.plugins.emailext.ExtendedEmailPublisher.sendMail(ExtendedEmailPublisher.java:306)
at hudson.plugins.emailext.ExtendedEmailPublisher._perform(ExtendedEmailPublisher.java:297)
at hudson.plugins.emailext.ExtendedEmailPublisher.perform(ExtendedEmailPublisher.java:244)
at org.jenkins_ci.plugins.run_condition.BuildStepRunner$2.run(BuildStepRunner.java:110)
at org.jenkins_ci.plugins.run_condition.BuildStepRunner$Fail.conditionalRun(BuildStepRunner.java:154)
at org.jenkins_ci.plugins.run_condition.BuildStepRunner.perform(BuildStepRunner.java:105)
at org.jenkins_ci.plugins.flexible_publish.ConditionalPublisher.perform(ConditionalPublisher.java:183)
at org.jenkins_ci.plugins.flexible_publish.FlexiblePublisher.perform(FlexiblePublisher.java:116)
at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:770)
at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:734)
at hudson.model.Build$BuildExecution.post2(Build.java:183)
at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:683)
at hudson.model.Run.execute(Run.java:1783)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:89)
at hudson.model.Executor.run(Executor.java:240)
Caused by: java.lang.UnsupportedOperationException: getAffectedFiles() is not implemented by this SCM
at hudson.scm.ChangeLogSet$Entry.getAffectedFiles(ChangeLogSet.java:242)
... 59 more

I think the email plugin is trying to get the list of users and this is null (and it doesn't do very good checking?)

The Jenkins summary page shows:
Summary Of Changes - View Detail
No connection to Perforce.

Add Comment Add Comment
 
This message was sent by Atlassian JIRA (v6.4.2#64017-sha1:e244265)
Atlassian logo

pallen@perforce.com (JIRA)

unread,
Sep 23, 2015, 10:10:01 AM9/23/15
to jenkinsc...@googlegroups.com

pallen@perforce.com (JIRA)

unread,
Sep 23, 2015, 10:14:03 AM9/23/15
to jenkinsc...@googlegroups.com
Paul Allen commented on Bug JENKINS-30525
 
Re: P4 plugin doesn't detect failure and can then cause other plugins to fail

Hi Morné
As we discussed yesterday at the London 'Perforce on Tour' event...
The shelfed change number disappears when submitted, so this needs to fail and abort the build.

morne.joubert@u-blox.com (JIRA)

unread,
Sep 23, 2015, 11:20:01 AM9/23/15
to jenkinsc...@googlegroups.com

I can think of the following potential conditions the plugin needs to check.

1) The CL is missing
2) The CL doesn't have any shelved changes
3) The CL is not valid for the stream that is used. e.g. if you shelved on a dev stream then you cannot unshelve on a mainline (since you don't have a branch spec)
you probably can think of a few more...

pallen@perforce.com (JIRA)

unread,
Sep 23, 2015, 11:41:01 AM9/23/15
to jenkinsc...@googlegroups.com

I have a reproduction and just starting to code the fix.
I was think of just trapping any unshelve error and aborting cleanly. Non fatal errors can then be excluded as required.

pallen@perforce.com (JIRA)

unread,
Sep 23, 2015, 11:45:02 AM9/23/15
to jenkinsc...@googlegroups.com

Now the builds halts after the unshelve task...

P4 Task: unshelve review: 8698
... p4 unshelve -f -s8698 -cdefault +
P4JAVA: Change 8698 unknown.
ERROR: P4JAVA: Error(s)
Finished: FAILURE

morne.joubert@u-blox.com (JIRA)

unread,
Sep 23, 2015, 11:50:01 AM9/23/15
to jenkinsc...@googlegroups.com

could you check that the default email plugin and the email-ext plugin that everyone uses works with your fixes.

the email plugins are throwing a wobbly when the unshelve doesn't work.

Caused by: java.lang.UnsupportedOperationException: getAffectedFiles() is not implemented by this SCM
at hudson.scm.ChangeLogSet$Entry.getAffectedFiles(ChangeLogSet.java:242)

scm_issue_link@java.net (JIRA)

unread,
Sep 23, 2015, 12:02:04 PM9/23/15
to jenkinsc...@googlegroups.com

Code changed in jenkins
User: Paul Allen
Path:
src/main/java/org/jenkinsci/plugins/p4/client/ClientHelper.java
src/main/java/org/jenkinsci/plugins/p4/client/ConnectionHelper.java
http://jenkins-ci.org/commit/p4-plugin/057d181bacfcc31c22e44309fbf6729884868542
Log:
Abort if unshelve fails.

JENKINS-30525

pallen@perforce.com (JIRA)

unread,
Sep 23, 2015, 12:03:02 PM9/23/15
to jenkinsc...@googlegroups.com

Sorry, I submitted that before seeing your post. I'll check the Email plugin tomorrow, unless you get there first.

morne.joubert@u-blox.com (JIRA)

unread,
Sep 25, 2015, 4:59:02 AM9/25/15
to jenkinsc...@googlegroups.com

Problem is still there.

P4 Task: unshelve review: 144856
... p4 unshelve -f -s144856 -cdefault


+
... p4 revert -k c:\jenkins\workspace__atf_int_mlb_0/...
+

... duration: (29ms)


P4 Task: saving built changes.

... p4 client -o __atf_int_mlb_0_jenkins_p4_2_mlb-TEST-gb-mlb-dt-019 +
... p4 change -o 144856 +
Unable to get changes: com.perforce.p4java.exception.RequestException: Change 144856 unknown.

... p4 client -o __atf_int_mlb_0_jenkins_p4_2_mlb-TEST-gb-mlb-dt-019 +
... p4 change -o 144856 +
Unable to get changes: com.perforce.p4java.exception.RequestException: Change 144856 unknown.

... done

if p4 change fails then it needs to fail the job

pallen@perforce.com (JIRA)

unread,
Sep 25, 2015, 7:35:02 AM9/25/15
to jenkinsc...@googlegroups.com

Looks like I need to expand the checking to other commands

Seems interesting that the change exists at the unshelve stage...

P4 Task: unshelve review: 144856
... p4 unshelve -f -s144856 -cdefault

but then is missing at the post build stage...

P4 Task: saving built changes.
... p4 client -o __atf_int_mlb_0_jenkins_p4_2_mlb-TEST-gb-mlb-dt-019 +
... p4 change -o 144856 +
Unable to get changes: com.perforce.p4java.exception.RequestException: Change 144856 unknown.

morne.joubert@u-blox.com (JIRA)

unread,
Sep 25, 2015, 8:26:02 AM9/25/15
to jenkinsc...@googlegroups.com

something that might be relevant is that you cannot unshelve any cl on any stream.
e.g. if i shelve on a dev stream then i cannot unshelve on a main (i need a branchspec for this)

So we need to check that the CL is a valid CL for the stream as well....

pallen@perforce.com (JIRA)

unread,
Sep 25, 2015, 9:16:01 AM9/25/15
to jenkinsc...@googlegroups.com

The recent fix should abort if there are any issues during the unshelve process (i.e. shelf is submitted or on a different stream).

What was puzzling is why can a build unshelve ok then at a later step fail to access the change. The only thing I can think of is the change was submitted or deleted part way through the build. That is why I need to add the extra checks. There is a 'p4 change -O' which looks up old changes (using the original number), that could work for the submit case, but not delete.

morne.joubert@u-blox.com (JIRA)

unread,
Sep 25, 2015, 9:23:01 AM9/25/15
to jenkinsc...@googlegroups.com

maybe we should first get the info for a change and then unshelve it.
if we can't get the info then we don't unshelve ?

pallen@perforce.com (JIRA)

unread,
Feb 11, 2016, 5:49:02 AM2/11/16
to jenkinsc...@googlegroups.com
Paul Allen closed an issue as Fixed
 
Change By: Paul Allen
Status: Open Closed
Resolution: Fixed
Reply all
Reply to author
Forward
0 new messages