Try/Catch around Failing Plugin

47 views
Skip to first unread message

treads...@gmail.com

unread,
Aug 25, 2016, 5:13:07 PM8/25/16
to Jenkins Users
Hi,

I'm trying to work around this bug where XUnit XMLs parsing crashes on Windows 10 nodes (https://issues.jenkins-ci.org/browse/JENKINS-34106)

I thought perhaps Pipeline steps might be the way to go and wrote this:

for (x = 0; x < 5; x++) {
   
try {
        step
([$class: 'XUnitPublisher', testTimeMargin: '3000', thresholdMode: 1, thresholds: [[$class: 'FailedThreshold', failureNewThreshold: '', failureThreshold: '', unstableNewThreshold: '', unstableThreshold: '0'], [$class: 'SkippedThreshold', failureNewThreshold: '', failureThreshold: '', unstableNewThreshold: '', unstableThreshold: '']], tools: [[$class: 'GoogleTestType', deleteOutputFiles: true, failIfNotNew: false, pattern: "_results/*/${config}/${arch}/tests/gtest*.xml", skipNoTestFiles: true, stopProcessingIfError: true]]])
       
break
   
} catch (any) { // XUnit fails on Win10, try again!
        echo
"XUnit crashed, trying again!"
        sleep
(5)
   
}
}

But this simply isn't working:

...
12:08:16 [xUnit] [INFO] - Starting to record.
12:08:16 [xUnit] [INFO] - Processing GoogleTest-1.6
12:08:16 [xUnit] [INFO] - [GoogleTest-1.6] - 11 test report file(s) were found with the pattern '_results/*/release/x64/tests/gtest*.xml' relative to 'c:\jenkins\workspace\pipeline_component_2' for the testing framework 'GoogleTest-1.6'.
12:08:21 [xUnit] [ERROR] - The plugin hasn't been performed correctly: remote file operation failed: c:\jenkins\workspace\pipeline_component_2 at hudson.remoting.Channel@4ef7f3ea:HOSTNAME: java.io.StreamCorruptedException: invalid type code: 43
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
Finished: FAILURE

Shouldn't try/catch intercept the exception?  Does anyone have any other ideas about how I can force it to retry?

Thanks in advance!

wak...@comcast.net

unread,
Aug 25, 2016, 5:24:47 PM8/25/16
to jenkins...@googlegroups.com
only if the exception is thrown on that thread the try/catch is executing on. If any of the instructions in the try block spawn/use another thread,
exceptions thrown on that spawned thread will NOT be caught by your catch block. 


From: treads...@gmail.com
To: "Jenkins Users" <jenkins...@googlegroups.com>
Sent: Thursday, August 25, 2016 5:13:06 PM
Subject: Try/Catch around Failing Plugin
--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/4503604d-af57-4cf6-b5cd-1274c93eb172%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages