/** * Given the environment variable of a process and the "model environment variable" that Hudson * used for launching the build, returns true if there's a match (which means the process should * be considered a descendant of a build.) */ public final boolean hasMatchingEnvVars(Map<String,String> modelEnvVar) { if(modelEnvVar.isEmpty()) // sanity check so that we don't start rampage. return false; SortedMap<String,String> envs = getEnvironmentVariables(); for (Entry<String,String> e : modelEnvVar.entrySet()) { String v = envs.get(e.getKey()); if(v==null || !v.equals(e.getValue())) return false; // no match } return true; }
/** * Immediate child processes. */ public final List<OSProcess> getChildren() { List<OSProcess> r = new ArrayList<OSProcess>(); for (OSProcess p : ProcessTree.this) if(p.getParent()==this) r.add(p); return r; }
if (SHOW_PID) { ProcessTree.OSProcess p = ProcessTree.get().get(proc); t.setName(oldName+" "+(p!=null?"waiting for pid="+p.getPid():"waiting for "+name));
if (SHOW_PID) { ProcessTree.OSProcess p = ProcessTree.get().get(proc); t.setName(oldName+" "+(p!=null?"waiting for pid="+p.getPid():"waiting for "+name));
if (SHOW_PID) { ProcessTree.OSProcess p = ProcessTree.get().get(proc); t.setName(oldName+" "+(p!=null?"waiting for pid="+p.getPid():"waiting for "+name));
if (SHOW_PID) { ProcessTree.OSProcess p = ProcessTree.get().get(proc); t.setName(oldName + " " + (p != null ? "waiting for pid=" + p.getPid() : "waiting for " + name));
if (SHOW_PID) { ProcessTree.OSProcess p = ProcessTree.get().get(proc); t.setName(oldName+" "+(p!=null?"waiting for pid="+p.getPid():"waiting for "+name));
if (SHOW_PID) { ProcessTree.OSProcess p = ProcessTree.get().get(proc); t.setName(oldName+" "+(p!=null?"waiting for pid="+p.getPid():"waiting for "+name));
ProcessTree pt = ProcessTree.get(); if(proc!=null) pt.get(proc).killRecursively(); if(modelEnvVars!=null) pt.killAll(modelEnvVars);
ProcessTree pt = ProcessTree.get(); if(proc!=null) pt.get(proc).killRecursively(); if(modelEnvVars!=null) pt.killAll(modelEnvVars);
ProcessTree pt = ProcessTree.get(); if(proc!=null) pt.get(proc).killRecursively(); if(modelEnvVars!=null) pt.killAll(modelEnvVars);
ProcessTree pt = ProcessTree.get(); if(proc!=null) pt.get(proc).killRecursively(); if(modelEnvVars!=null) pt.killAll(modelEnvVars);
ProcessTree pt = ProcessTree.get(); if (proc != null) { pt.get(proc).killRecursively();
@Override public void killAll(Map<String, String> modelEnvVars) throws InterruptedException { for( OSProcess p : this) { if(p.getPid()<10) continue; // ignore system processes like "idle process" LOGGER.log(FINEST, "Considering to kill {0}", p.getPid()); boolean matched; try { matched = hasMatchingEnvVars(p, modelEnvVars); } catch (WindowsOSProcessException e) { // likely a missing privilege // TODO: not a minor issue - causes process termination error in JENKINS-30782 if (LOGGER.isLoggable(FINEST)) { LOGGER.log(FINEST, "Failed to check environment variable match for process with pid=" + p.getPid() ,e); } continue; } if(matched) { p.killRecursively(); } else { LOGGER.log(Level.FINEST, "Environment variable didn't match for process with pid={0}", p.getPid()); } } }
/** * Given the environment variable of a process and the "model * environment variable" that Hudson used for launching the build, * returns true if there's a match (which means the process should be * considered a descendant of a build.) */ public final boolean hasMatchingEnvVars(Map<String, String> modelEnvVar) { if (modelEnvVar.isEmpty()) // sanity check so that we don't start rampage. { return false; } SortedMap<String, String> envs = getEnvironmentVariables(); for (Entry<String, String> e : modelEnvVar.entrySet()) { String v = envs.get(e.getKey()); if (v == null || !v.equals(e.getValue())) { return false; // no match } } return true; }
public void killAll(Map<String, String> modelEnvVars) throws InterruptedException { for (OSProcess p : this) { if (p.getPid() < 10) { continue; // ignore system processes like "idle process" } boolean matched; try { matched = p.hasMatchingEnvVars(modelEnvVars); } catch (NativeAccessException e) { // likely a missing privilege logger.debug( " Failed to check environment variable match", e); continue; } if (matched) { logger.debug("Killing process started by build " + p.getPid()); p.killRecursively(); } } } }
public void killAll(Map<String, String> modelEnvVars) throws InterruptedException { for (OSProcess p : this) { if (p.getPid() < 10) { continue; // ignore system processes like "idle process" } boolean matched; try { matched = p.hasMatchingEnvVars(modelEnvVars); } catch (NativeAccessException e) { // likely a missing privilege logger.debug(" Failed to check environment variable match", e); continue; } if (matched) { logger.debug("Killing process started by build " + p.getPid()); p.killRecursively(); } } } }
public void killAll(Map<String, String> modelEnvVars) throws InterruptedException { for( OSProcess p : this) { if(p.getPid()<10) continue; // ignore system processes like "idle process" LOGGER.finest("Considering to kill "+p.getPid()); boolean matched; try { matched = p.hasMatchingEnvVars(modelEnvVars); } catch (WinpException e) { // likely a missing privilege LOGGER.log(FINEST," Failed to check environment variable match",e); continue; } if(matched) p.killRecursively(); else LOGGER.finest("Environment variable didn't match"); } }
public void killAll(Map<String, String> modelEnvVars) throws InterruptedException { for( OSProcess p : this) { if(p.getPid()<10) continue; // ignore system processes like "idle process" LOGGER.finest("Considering to kill "+p.getPid()); boolean matched; try { matched = p.hasMatchingEnvVars(modelEnvVars); } catch (WinpException e) { // likely a missing privilege LOGGER.log(FINEST," Failed to check environment variable match",e); continue; } if(matched) p.killRecursively(); else LOGGER.finest("Environment variable didn't match"); } }
/** * Given the environment variable of a process and the "model environment variable" that Hudson * used for launching the build, returns true if there's a match (which means the process should * be considered a descendant of a build.) */ public final boolean hasMatchingEnvVars(Map<String,String> modelEnvVar) { if(modelEnvVar.isEmpty()) // sanity check so that we don't start rampage. return false; SortedMap<String,String> envs = getEnvironmentVariables(); for (Entry<String,String> e : modelEnvVar.entrySet()) { String v = envs.get(e.getKey()); if(v==null || !v.equals(e.getValue())) return false; // no match } return true; }