echonesis commented on code in PR #11225:
URL: https://github.com/apache/ozone/pull/11225#discussion_r4001878192
##########
hadoop-hdds/client/src/main/java/org/apache/hadoop/hdds/scm/XceiverClientShortCircuit.java:
##########
@@ -402,27 +464,40 @@ public void run() {
// send request body
request.writeDelimitedTo(dataOut);
dataOut.flush();
+ } catch (IOException e) {
+ isDomainSocketOpen.set(false);
+ failure = e;
+ pending = new ArrayList<>(sentRequests.values());
} finally {
- lock.unlock();
entry.setSentTimeNs();
requestSent++;
}
- } catch (IOException e) {
- LOG.error("Failed to send command {}", request, e);
- entry.getFuture().completeExceptionally(e);
+ } finally {
+ lock.unlock();
+ }
+ if (failure != null) {
+ LOG.error("Failed to send command {}", request, failure);
+ for (RequestEntry requestEntry : pending) {
+ requestEntry.fail(failure);
+ }
metrics.decrPendingContainerOpsMetrics(request.getCmdType());
metrics.addContainerOpsLatency(request.getCmdType(), System.nanoTime() -
entry.getCreateTimeNs());
Review Comment:
Good catch. A write failure makes the shared domain socket unusable, so all
requests still registered in sentRequests need terminal metrics accounting,
rather than only the request whose write failed.
I changed this path to conditionally remove and collect the pending entries
while holding the client lock, then fail each collected request and update its
pending and latency metrics after releasing the lock. The conditional removal
also prevents duplicate accounting against a concurrent response or timeout.
--
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]