Dear all, 

I have a build step that is steaming console logs from external Jenkins and 
puts it into the current job's console.
I'm using "progressiveText" REST API to get this data. The streaming goes 
on while the remote job is running. 

I have put a Thread.sleep() to wait before each next request (while there's 
"X-More-Data" header being returned). However, sometimes Thread.sleep() 
throws an InterruptedException - which means that the current thread (in 
which the job is running) was interrupted. What can be the reasons for 
this? I googled a bit and few reasons can be:
- job being aborted (not the case);
- Web robot visiting REST API links and stopping jobs (not the case, both 
Jenkins servers are private);
- Jenkins shutting down (not the case);
- Linux is killing processes that take too much memory;

Any other reasons?

Is it possible to find out who interrupts the current thread? 

Also, I'm not sure how to handle this correctly. If I swallow the 
InterruptedException, build will be uncancellable; if I swallow it and the 
restore the interrupted status later, when the streaming is finished, 
Jenkins will probably fail the build (not sure whether that'll be correct). 
If I don't restore the interrupted status, this becomes dangerous, and the 
build will be uncancellable - the only way to stop it in case it hangs or 
started by mistake will be Jenkins restart. The main question is what's 
causing interruption and how do I distinguish it from "good" interruption 
like manual job cancellation or Jenkins shutdown.

Any help is much appreciated!!!

Regards,
Kirill.

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-dev/61856377-0827-41a5-a9ce-eaa64eb894fc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to