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,
not only the request whose write failed.
I will remove and collect the pending entries under the client lock using
conditional `sentRequests.remove(key, entry)`. After releasing the lock, each
collected entry will have its future failed, its pending metric decremented,
and its latency recorded. This also removes failed entries from the map and
prevents double accounting against a concurrent receiver 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]