未验证 提交 9801bd96 编写于 作者: O Oleg Nenashev 提交者: GitHub

Merge pull request #3627 from KostyaSha/processKiller

[JENKINS-53593] Fix class loader error specific to OS.
...@@ -43,7 +43,16 @@ import jenkins.security.SlaveToMasterCallable; ...@@ -43,7 +43,16 @@ import jenkins.security.SlaveToMasterCallable;
import org.jvnet.winp.WinProcess; import org.jvnet.winp.WinProcess;
import org.jvnet.winp.WinpException; import org.jvnet.winp.WinpException;
import java.io.*; import java.io.BufferedReader;
import java.io.ByteArrayOutputStream;
import java.io.DataInputStream;
import java.io.File;
import java.io.FileFilter;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.RandomAccessFile;
import java.io.Serializable;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException; import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method; import java.lang.reflect.Method;
...@@ -175,8 +184,8 @@ public abstract class ProcessTree implements Iterable<OSProcess>, IProcessTree, ...@@ -175,8 +184,8 @@ public abstract class ProcessTree implements Iterable<OSProcess>, IProcessTree,
// let's do with what we have. // let's do with what we have.
killers = Collections.emptyList(); killers = Collections.emptyList();
} }
} catch (IOException e) { } catch (IOException | Error e) {
LOGGER.log(Level.WARNING, "Failed to obtain killers",e); LOGGER.log(Level.WARNING, "Failed to obtain killers", e);
killers = Collections.emptyList(); killers = Collections.emptyList();
} }
return killers; return killers;
...@@ -232,10 +241,11 @@ public abstract class ProcessTree implements Iterable<OSProcess>, IProcessTree, ...@@ -232,10 +241,11 @@ public abstract class ProcessTree implements Iterable<OSProcess>, IProcessTree,
void killByKiller() throws InterruptedException { void killByKiller() throws InterruptedException {
for (ProcessKiller killer : getKillers()) for (ProcessKiller killer : getKillers())
try { try {
if (killer.kill(this)) if (killer.kill(this)) {
break; break;
} catch (IOException e) { }
LOGGER.log(Level.WARNING, "Failed to kill pid="+getPid(),e); } catch (IOException | Error e) {
LOGGER.log(Level.WARNING, "Failed to kill pid=" + getPid(), e);
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册