aajisaka commented on a change in pull request #2775:
URL: https://github.com/apache/hadoop/pull/2775#discussion_r608365538
##########
File path:
hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/pipes/Application.java
##########
@@ -133,6 +135,10 @@
process = runClient(cmd, env);
clientSocket = serverSocket.accept();
+ // start ping socket cleaner
+ socketCleaner = new PingSocketCleaner("ping-socket-cleaner");
+ socketCleaner.setDaemon(true);
+ socketCleaner.start();
Review comment:
The cleaner thread is never stopped. Would you clean up the thread in
the cleanup method?
##########
File path:
hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/pipes/Application.java
##########
@@ -266,4 +272,32 @@ public static String createDigest(byte[] password, String
data)
return SecureShuffleUtils.hashFromString(data, key);
}
+ private class PingSocketCleaner extends Thread {
+ PingSocketCleaner(String name) {
+ super(name);
+ }
+
+ @Override
+ public void run() {
+ LOG.info("PingSocketCleaner started...");
+ while (true) {
+ Socket clientSocket = null;
+ try {
+ clientSocket = serverSocket.accept();
+ LOG.debug("Connection received from {}",
clientSocket.getInetAddress());
+ int readData = 0;
+ while (readData != -1) {
+ readData = clientSocket.getInputStream().read();
+ }
+ LOG.debug("close socket cause client has closed.");
+ clientSocket.close();
+ } catch (IOException exception) {
+ LOG.error("PingSocketCleaner exception", exception);
+ IOUtils.closeSocket(clientSocket);
Review comment:
Do not need this line. `IOUtils.closeSocket` in the finally clause is
always executed.
```suggestion
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]