YARN-5257. Fix unreleased resources and null dereferences (yufeigu via rkanter)
This commit is contained in:
parent
1bbd023275
commit
9262797e86
|
@ -192,10 +192,10 @@ public class UnmanagedAMLauncher {
|
||||||
throw new RuntimeException(ex);
|
throw new RuntimeException(ex);
|
||||||
}
|
}
|
||||||
tokenFile.deleteOnExit();
|
tokenFile.deleteOnExit();
|
||||||
DataOutputStream os = new DataOutputStream(new FileOutputStream(tokenFile,
|
try (DataOutputStream os = new DataOutputStream(
|
||||||
true));
|
new FileOutputStream(tokenFile, true))) {
|
||||||
credentials.writeTokenStorageToStream(os);
|
credentials.writeTokenStorageToStream(os);
|
||||||
os.close();
|
}
|
||||||
|
|
||||||
Map<String, String> env = System.getenv();
|
Map<String, String> env = System.getenv();
|
||||||
ArrayList<String> envAMList = new ArrayList<String>();
|
ArrayList<String> envAMList = new ArrayList<String>();
|
||||||
|
|
|
@ -774,7 +774,7 @@ public class TopCLI extends YarnCLI {
|
||||||
|
|
||||||
private JSONObject getJSONObject(URLConnection conn)
|
private JSONObject getJSONObject(URLConnection conn)
|
||||||
throws IOException, JSONException {
|
throws IOException, JSONException {
|
||||||
InputStream in = conn.getInputStream();
|
try(InputStream in = conn.getInputStream()) {
|
||||||
String encoding = conn.getContentEncoding();
|
String encoding = conn.getContentEncoding();
|
||||||
encoding = encoding == null ? "UTF-8" : encoding;
|
encoding = encoding == null ? "UTF-8" : encoding;
|
||||||
String body = IOUtils.toString(in, encoding);
|
String body = IOUtils.toString(in, encoding);
|
||||||
|
@ -782,6 +782,7 @@ public class TopCLI extends YarnCLI {
|
||||||
JSONObject clusterInfo = obj.getJSONObject("clusterInfo");
|
JSONObject clusterInfo = obj.getJSONObject("clusterInfo");
|
||||||
return clusterInfo;
|
return clusterInfo;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private URL getClusterUrl() throws Exception {
|
private URL getClusterUrl() throws Exception {
|
||||||
URL url = null;
|
URL url = null;
|
||||||
|
|
|
@ -805,7 +805,7 @@ public class TimelineClientImpl extends TimelineClient {
|
||||||
error.getErrorCode());
|
error.getErrorCode());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (type.equals(DOMAIN_DATA_TYPE)) {
|
} else if (type.equals(DOMAIN_DATA_TYPE) && domains != null) {
|
||||||
boolean hasError = false;
|
boolean hasError = false;
|
||||||
for (TimelineDomain domain : domains.getDomains()) {
|
for (TimelineDomain domain : domains.getDomains()) {
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -189,7 +189,7 @@ public class Graph {
|
||||||
|
|
||||||
public void save(String filepath) throws IOException {
|
public void save(String filepath) throws IOException {
|
||||||
try (OutputStreamWriter fout = new OutputStreamWriter(
|
try (OutputStreamWriter fout = new OutputStreamWriter(
|
||||||
new FileOutputStream(filepath), Charset.forName("UTF-8"));) {
|
new FileOutputStream(filepath), Charset.forName("UTF-8"))) {
|
||||||
fout.write(generateGraphViz());
|
fout.write(generateGraphViz());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,8 +49,10 @@ public class VisualizeStateMachine {
|
||||||
if (gname.endsWith("Impl")) {
|
if (gname.endsWith("Impl")) {
|
||||||
gname = gname.substring(0, gname.length()-4);
|
gname = gname.substring(0, gname.length()-4);
|
||||||
}
|
}
|
||||||
|
if (ret != null) {
|
||||||
ret.addSubGraph(factory.generateStateGraph(gname));
|
ret.addSubGraph(factory.generateStateGraph(gname));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -803,8 +803,11 @@ public class ProcfsBasedProcessTree extends ResourceCalculatorProcessTree {
|
||||||
if (LOG.isDebugEnabled()) {
|
if (LOG.isDebugEnabled()) {
|
||||||
LOG.debug("MemInfo : " + key + " : Value : " + value);
|
LOG.debug("MemInfo : " + key + " : Value : " + value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (memoryMappingInfo != null) {
|
||||||
memoryMappingInfo.setMemInfo(key, value);
|
memoryMappingInfo.setMemInfo(key, value);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
LOG
|
LOG
|
||||||
.warn("Error parsing smaps line : " + line + "; " + t.getMessage());
|
.warn("Error parsing smaps line : " + line + "; " + t.getMessage());
|
||||||
|
|
|
@ -603,7 +603,7 @@ public class ApplicationImpl implements Application {
|
||||||
} catch (InvalidStateTransitionException e) {
|
} catch (InvalidStateTransitionException e) {
|
||||||
LOG.warn("Can't handle this event at current state", e);
|
LOG.warn("Can't handle this event at current state", e);
|
||||||
}
|
}
|
||||||
if (oldState != newState) {
|
if (newState != null && oldState != newState) {
|
||||||
LOG.info("Application " + applicationID + " transitioned from "
|
LOG.info("Application " + applicationID + " transitioned from "
|
||||||
+ oldState + " to " + newState);
|
+ oldState + " to " + newState);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1680,7 +1680,7 @@ public class ContainerImpl implements Container {
|
||||||
+ oldState + "], eventType: [" + event.getType() + "]," +
|
+ oldState + "], eventType: [" + event.getType() + "]," +
|
||||||
" container: [" + containerID + "]", e);
|
" container: [" + containerID + "]", e);
|
||||||
}
|
}
|
||||||
if (oldState != newState) {
|
if (newState != null && oldState != newState) {
|
||||||
LOG.info("Container " + containerID + " transitioned from "
|
LOG.info("Container " + containerID + " transitioned from "
|
||||||
+ oldState
|
+ oldState
|
||||||
+ " to " + newState);
|
+ " to " + newState);
|
||||||
|
|
|
@ -626,15 +626,16 @@ import java.util.regex.Pattern;
|
||||||
try {
|
try {
|
||||||
File tcCmds = File.createTempFile(TMP_FILE_PREFIX, TMP_FILE_SUFFIX, new
|
File tcCmds = File.createTempFile(TMP_FILE_PREFIX, TMP_FILE_SUFFIX, new
|
||||||
File(tmpDirPath));
|
File(tmpDirPath));
|
||||||
|
|
||||||
|
try (
|
||||||
Writer writer = new OutputStreamWriter(new FileOutputStream(tcCmds),
|
Writer writer = new OutputStreamWriter(new FileOutputStream(tcCmds),
|
||||||
"UTF-8");
|
"UTF-8");
|
||||||
PrintWriter printWriter = new PrintWriter(writer);
|
PrintWriter printWriter = new PrintWriter(writer)) {
|
||||||
|
|
||||||
for (String command : commands) {
|
for (String command : commands) {
|
||||||
printWriter.println(command);
|
printWriter.println(command);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
printWriter.close();
|
|
||||||
operation.appendArgs(tcCmds.getAbsolutePath());
|
operation.appendArgs(tcCmds.getAbsolutePath());
|
||||||
|
|
||||||
return operation;
|
return operation;
|
||||||
|
|
|
@ -200,7 +200,7 @@ public class LocalizedResource implements EventHandler<ResourceEvent> {
|
||||||
} catch (InvalidStateTransitionException e) {
|
} catch (InvalidStateTransitionException e) {
|
||||||
LOG.warn("Can't handle this event at current state", e);
|
LOG.warn("Can't handle this event at current state", e);
|
||||||
}
|
}
|
||||||
if (oldState != newState) {
|
if (newState != null && oldState != newState) {
|
||||||
if (LOG.isDebugEnabled()) {
|
if (LOG.isDebugEnabled()) {
|
||||||
LOG.debug("Resource " + resourcePath + (localPath != null ?
|
LOG.debug("Resource " + resourcePath + (localPath != null ?
|
||||||
"(->" + localPath + ")": "") + " transitioned from " + oldState
|
"(->" + localPath + ")": "") + " transitioned from " + oldState
|
||||||
|
|
|
@ -1051,6 +1051,7 @@ public class ResourceLocalizationService extends CompositeService
|
||||||
LOG.error(
|
LOG.error(
|
||||||
"Got exception in parsing URL of LocalResource:"
|
"Got exception in parsing URL of LocalResource:"
|
||||||
+ rsrc.getResource(), e);
|
+ rsrc.getResource(), e);
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
LocalizerResourceRequestEvent assoc = scheduled.get(req);
|
LocalizerResourceRequestEvent assoc = scheduled.get(req);
|
||||||
if (assoc == null) {
|
if (assoc == null) {
|
||||||
|
|
Loading…
Reference in New Issue