Hello,

I am experiencing a strange difference with catching a timeout within a 
script in a step or a script called from a step.

The problem I want to work around: in some situations my unit-test exe 
(GoogleTest) is blocked with a popup from inside the C-runtime. To make the 
build complete in this szenario I inserted a timeout and want to catch it.

This is working as expected in a szenario like this:

def testModule() {

       try{                                        
           timeout(time: 30, unit: 'MINUTES') {                
               bat "dmake run-test"
            }
        } catch (err) {
            echo "Caught: ${err}"
            unstable( message: "Test timeout in stage ${STAGE_NAME}" )
        }
}

pipeline {
   ...
   stages {
   ...
stage( 'test' ) {
            steps {
                script{
                    testModule( )
                }
            }
        }     
}
}

When I try this instead:
stage('Test'){
      steps {
         script{
            try{                                        
               timeout(time: 30, unit: 'MINUTES') {                
                            bat "dmake runtest"
                        }
                      } catch (err) {
                        echo "Caught: ${err}"
                        unstable( message: "Test timeout in stage 
${STAGE_NAME}" )
                      }
                   }
}}
I get  number of exceptions from execution like this:

" Cancelling nested steps due to timeout 
*11:44:57* Sending interrupt signal to process 
*11:45:17* After 20s process did not stop 
*11:45:18* Also: Also: java.nio.file.FileSystemException: 
D:\workdir\workspace\
Build-Pipeline@tmp\durable-2328b9da\jenkins-log.txt: The process cannot 
access the file because it is being used by another process. 
*11:45:18* *11:45:18* at 
sun.nio.fs.WindowsException.translateToIOException(Unknown Source) 
*11:45:18* at sun.nio.fs.WindowsException.rethrowAsIOException(Unknown 
Source) 
*11:45:18* at sun.nio.fs.WindowsException.rethrowAsIOException(Unknown 
Source) 
*11:45:18* at sun.nio.fs.WindowsFileSystemProvider.implDelete(Unknown 
Source) 
*11:45:18* at sun.nio.fs.AbstractFileSystemProvider.deleteIfExists(Unknown 
Source) 
*11:45:18* at java.nio.file.Files.deleteIfExists(Unknown Source) 
*11:45:18* at 
jenkins.util.io.PathRemover.removeOrMakeRemovableThenRemove(PathRemover.java:237)
 

*...* "

and also at the very end:
"
Also: hudson.remoting.Channel$CallSiteStackTrace: Remote call to 
JNLP4-connect connection from server.com/xxx.yyy.zzz.182:pppp *11:46:26* at 
hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1800) 
*11:46:26* at 
hudson.remoting.UserRequest$ExceptionResponse.retrieve(UserRequest.java:357) 
*11:46:26* at hudson.remoting.Channel.call(Channel.java:1001) *11:46:26* at 
hudson.FilePath.act(FilePath.java:1070) 
" 

Does anyone have an explenation for thet difference and can give me a 
workaround?

TIA,
br,
Christoph

-- 
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-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/205bbfd4-1316-4665-8f7a-eef646a82534n%40googlegroups.com.

Reply via email to