HADOOP-14062. ApplicationMasterProtocolPBClientImpl.allocate fails with EOFException when RPC privacy is enabled. Contributed by Steven Rand

This commit is contained in:
Jian He 2017-03-08 10:48:27 -08:00
parent 287ba4ffa6
commit 241c1cc05b
2 changed files with 27 additions and 1 deletions

View File

@ -1768,7 +1768,9 @@ public class Client implements AutoCloseable {
}
void setSaslClient(SaslRpcClient client) throws IOException {
setInputStream(client.getInputStream(in));
// Wrap the input stream in a BufferedInputStream to fill the buffer
// before reading its length (HADOOP-14062).
setInputStream(new BufferedInputStream(client.getInputStream(in)));
setOutputStream(client.getOutputStream(out));
}

View File

@ -137,6 +137,11 @@ public class TestAMRMClient {
// set the minimum allocation so that resource decrease can go under 1024
conf.setInt(YarnConfiguration.RM_SCHEDULER_MINIMUM_ALLOCATION_MB, 512);
conf.setLong(YarnConfiguration.NM_LOG_RETAIN_SECONDS, 1);
createClientAndCluster(conf);
}
private static void createClientAndCluster(Configuration conf)
throws Exception {
yarnCluster = new MiniYARNCluster(TestAMRMClient.class.getName(), nodeCount, 1, 1);
yarnCluster.init(conf);
yarnCluster.start();
@ -861,6 +866,25 @@ public class TestAMRMClient {
initAMRMClientAndTest(false);
}
@Test (timeout=60000)
public void testAMRMClientWithSaslEncryption() throws Exception {
conf.set("hadoop.rpc.protection", "privacy");
// we have to create a new instance of MiniYARNCluster to avoid SASL qop
// mismatches between client and server
tearDown();
createClientAndCluster(conf);
startApp();
initAMRMClientAndTest(false);
// recreate the original MiniYARNCluster and YarnClient for other tests
conf.unset("hadoop.rpc.protection");
tearDown();
createClientAndCluster(conf);
// unless we start an application the cancelApp() method will fail when
// it runs after this test
startApp();
}
@Test (timeout=60000)
public void testAMRMClientAllocReqId() throws YarnException, IOException {
initAMRMClientAndTest(true);