symious opened a new pull request, #12107: URL: https://github.com/apache/ozone/pull/12107
## What changes were proposed in this pull request? XceiverServerGrpc serves client requests on one fixed-size read executor with an unbounded queue. When a datanode is overloaded (slow disk, high iowait), requests can wait in this queue longer than the client timeout (ozone.client.read.timeout, 30s, sent as the gRPC deadline). The client then fails with DEADLINE_EXCEEDED and retries elsewhere, but the datanode still executes the stale request once it is dequeued: it opens the block file, reads the chunk from disk, and only then finds the call gone (CANCELLED: client cancelled). In one incident a single datanode logged ~53k of these within ten minutes, all disk I/O spent on responses nobody waited for, while the disks were already saturated. This PR makes GrpcXceiverService check Context.current().isCancelled() before dispatching a request and skip it if the call is already cancelled. This works even while the request is queued: grpc-java creates the server call context with withDeadline(..., transport.getScheduledExecutorService()), so the transport timer cancels it when the client deadline passes, independent of the busy read executor. gRPC also closes the stream on expiry, so nothing has to be sent back. Streaming ReadBlock calls have no deadline and are not affected. A counter for skipped requests is left out to keep the change small; the read executor metrics are tracked in HDDS-17168. ## What is the link to the Apache JIRA [https://issues.apache.org/jira/browse/HDDS-17877](https://issues.apache.org/jira/browse/HDDS-17877) ## How was this patch tested? Added TestGrpcXceiverService#cancelledCallIsNotDispatched, which calls onNext inside a cancelled context and verifies that nothing is dispatched or sent back. The test fails without the change. -- 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]
