steveloughran commented on code in PR #5366:
URL: https://github.com/apache/hadoop/pull/5366#discussion_r1099988188
##########
hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ipc/Client.java:
##########
@@ -1241,9 +1301,28 @@ private void receiveRpcResponse() {
markClosed(e);
}
}
-
+
+ /**
+ * Mark the connection as closed due to an exception.
+ * Sets the {@link #shouldCloseConnection} boolean to true,
+ * and, if it was false earlier, drains the queue before
+ * notifying any waiting objects.
+ * @param e exception which triggered the closure; may be null.
+ */
private synchronized void markClosed(IOException e) {
if (shouldCloseConnection.compareAndSet(false, true)) {
+ Pair<Call, ResponseBuffer> request;
+ while ((request = rpcRequestQueue.poll()) != null) {
+ LOG.debug("Clean {} from RpcRequestQueue.", request.getLeft());
+ }
+ if (queueReservations.get() > 0) {
+ // there's still an active reservation.
+ // either a new put() is about to happen (bad),
+ // or it has happened but the finally {} clause has not been invoked
(good).
+ // without knowing which, print a warning message so at least logs on
+ // a deadlock are meaningful.
+ LOG.warn("Possible overlap in queue shutdown and request");
Review Comment:
ok. with the design of owens patch you should just have 1 thread in put()
and one worker, but good to show.
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]