[JAVA] setDefaultUncaughtExceptionHandler to log uncaught exception in user thread. (#4798)

* Add WorkerUncaughtExceptionHandler

* Fix

* revert bazel and pom
This commit is contained in:
Yuhong Guo 2019-05-16 19:53:15 +08:00 committed by GitHub
parent 1490a98a71
commit 98dd033179
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 2 deletions

View file

@ -76,13 +76,13 @@ public class GcsClient {
NodeInfo nodeInfo = new NodeInfo(
clientId, data.nodeManagerAddress(), true, resources);
clients.put(clientId, nodeInfo);
} else if (data.entryType() == EntryType.RES_CREATEUPDATE){
} else if (data.entryType() == EntryType.RES_CREATEUPDATE) {
Preconditions.checkState(clients.containsKey(clientId));
NodeInfo nodeInfo = clients.get(clientId);
for (int i = 0; i < data.resourcesTotalLabelLength(); i++) {
nodeInfo.resources.put(data.resourcesTotalLabel(i), data.resourcesTotalCapacity(i));
}
} else if (data.entryType() == EntryType.RES_DELETE){
} else if (data.entryType() == EntryType.RES_DELETE) {
Preconditions.checkState(clients.containsKey(clientId));
NodeInfo nodeInfo = clients.get(clientId);
for (int i = 0; i < data.resourcesTotalLabelLength(); i++) {

View file

@ -15,6 +15,9 @@ public class DefaultWorker {
public static void main(String[] args) {
try {
System.setProperty("ray.worker.mode", "WORKER");
Thread.setDefaultUncaughtExceptionHandler((Thread t, Throwable e) -> {
LOGGER.error("Uncaught worker exception in thread {}: {}", t, e);
});
Ray.init();
LOGGER.info("Worker started.");
((AbstractRayRuntime)Ray.internal()).loop();