Fix crash caused by unit test testWaitAndCrash (#6549)

This commit is contained in:
Kai Yang
2019-12-20 11:06:53 +08:00
committed by Hao Chen
parent e556b729c2
commit af9f76359a
3 changed files with 44 additions and 23 deletions
@@ -7,7 +7,9 @@ import org.ray.api.RayObject;
import org.ray.api.TestUtils;
import org.ray.api.exception.RayException;
import org.ray.api.id.ObjectId;
import org.ray.runtime.RayNativeRuntime;
import org.ray.runtime.object.RayObjectImpl;
import org.ray.runtime.runner.RunManager;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.testng.Assert;
@@ -26,7 +28,11 @@ public class ClientExceptionTest extends BaseTest {
Thread thread = new Thread(() -> {
try {
TimeUnit.SECONDS.sleep(1);
Ray.shutdown();
// kill raylet
RunManager runManager = ((RayNativeRuntime) TestUtils.getRuntime()).getRunManager();
for (Process process : runManager.getProcesses("raylet")) {
runManager.terminateProcess("raylet", process);
}
} catch (InterruptedException e) {
LOGGER.error("Got InterruptedException when sleeping, exit right now.");
throw new RuntimeException("Got InterruptedException when sleeping.", e);