[ 
https://issues.apache.org/jira/browse/HADOOP-18324?focusedWorklogId=791250&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-791250
 ]

ASF GitHub Bot logged work on HADOOP-18324:
-------------------------------------------

                Author: ASF GitHub Bot
            Created on: 15/Jul/22 04:00
            Start Date: 15/Jul/22 04:00
    Worklog Time Spent: 10m 
      Work Description: Hexiaoqiao commented on code in PR #4527:
URL: https://github.com/apache/hadoop/pull/4527#discussion_r921788650


##########
hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ipc/Client.java:
##########
@@ -1153,9 +1087,51 @@ public void run() {
             + connections.size());
     }
 
+    /**
+     * A thread to write rpc requests to the socket.
+     */
+    private class RpcRequestSender implements Runnable {
+      @Override
+      public void run() {
+        while (!shouldCloseConnection.get()) {
+          ResponseBuffer buf = null;
+          try {
+            Pair<Call, ResponseBuffer> pair = rpcRequestQueue.take();
+            if (shouldCloseConnection.get()) {
+              return;
+            }
+            buf = pair.getRight();
+            synchronized (ipcStreams.out) {
+              if (LOG.isDebugEnabled()) {
+                Call call = pair.getLeft();
+                LOG.debug(getName() + " sending #" + call.id
+                    + " " + call.rpcRequest);
+              }
+              // RpcRequestHeader + RpcRequest
+              ipcStreams.sendRequest(buf.toByteArray());
+              ipcStreams.flush();
+            }
+          } catch (InterruptedException ie) {
+            // stop this thread

Review Comment:
   Should we also mark connection closed here when meet InterruptedException?





Issue Time Tracking
-------------------

    Worklog Id:     (was: 791250)
    Time Spent: 2h 40m  (was: 2.5h)

> Interrupting RPC Client calls can lead to thread exhaustion
> -----------------------------------------------------------
>
>                 Key: HADOOP-18324
>                 URL: https://issues.apache.org/jira/browse/HADOOP-18324
>             Project: Hadoop Common
>          Issue Type: Bug
>          Components: ipc
>    Affects Versions: 3.4.0, 2.10.2, 3.3.3
>            Reporter: Owen O'Malley
>            Assignee: Owen O'Malley
>            Priority: Critical
>              Labels: pull-request-available
>          Time Spent: 2h 40m
>  Remaining Estimate: 0h
>
> Currently the IPC client creates a boundless number of threads to write the 
> rpc request to the socket. The NameNode uses timeouts on its RPC calls to the 
> Journal Node and a stuck JN will cause the NN to create an infinite set of 
> threads.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to