smengcl opened a new pull request, #8902:
URL: https://github.com/apache/hadoop/pull/8902

   Generated-by: Claude Code (Opus 5.5)
   
   JIRA: https://issues.apache.org/jira/browse/HADOOP-20047
   
   ### Description of PR
   
   `RetryInvocationHandler` sets the thread local call id and retry count 
before each attempt, and only `Client.Call` clears the call id when it is 
created. When an attempt issues no RPC (calling `toString` or `hashCode` on the 
retry proxy, or the protocol translator throwing before `Client.call`), the 
call id stays set. The next attempt on the same thread then fails 
`checkState(callId.get() == null)` in `Client.setCallIdAndRetryCount` with a 
bare `IllegalStateException`, which aborts the retry and every later call made 
on that thread. For asynchronous calls the retries run on the retry handler's 
thread, so every later call on that handler is affected.
   
   This patch clears the call id, retry count and external handler after each 
attempt that set them, using the same reset `RequestHedgingProxyProvider` 
already applies. It changes nothing when `SET_CALL_ID_FOR_TEST` is off.
   
   This also covers HDFS-8409 and HDFS-11351. Apache Ozone hit the same fault 
in its copy of this code and fixed it as HDDS-16745.
   
   ### How was this patch tested?
   
   Added `TestRetryProxy#testCallIdClearedWhenNoRpcIsIssued`: through a retry 
proxy over an RPC translator, calls `toString` and then twice a method that 
throws before issuing the RPC. Without the fix the calls fail with 
`IllegalStateException`; with it they fail with the expected `FatalException`.
   
   Also ran `TestRetryProxy`, `TestFailoverProxy`, `TestDefaultRetryPolicy`, 
`TestAsyncIPC`, `TestRetryCache`, `TestIPCServerResponder`, `TestIPC` and 
`TestRPC` locally. All pass except five `TestIPC` tests and two `TestRPC` tests 
that fail, or fail intermittently, the same way without this patch on the test 
machine (connection resets and socket timeouts on its network).
   
   ### For code changes:
   
   - [x] Does the title of this PR start with the corresponding JIRA issue id 
(e.g. 'HADOOP-17799. Your PR title ...')?
   - [ ] Object storage: Have the integration tests been executed and the 
endpoint declared according to the connector-specific documentation?
   - [ ] If adding new dependencies to the code, are these dependencies 
licensed in a way that is compatible for inclusion under [ASF 
2.0](http://www.apache.org/legal/resolved.html#category-a)?
   - [ ] If applicable, have you updated the `LICENSE`, `LICENSE-binary`, 
`NOTICE-binary` files?
   
   ### AI Tooling
   
   - [x] The PR includes the phrase "Contains content generated by Claude Code 
(Opus 5.5)".
   - [x] My use of AI contributions follows the ASF legal policy 
https://www.apache.org/legal/generative-tooling.html
   
   Contains content generated by Claude Code (Opus 5.5).
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


-- 
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]

Reply via email to