Aias00 opened a new issue, #7975: URL: https://github.com/apache/shenyu/issues/7975
### Is there an existing issue for this? - [x] I have searched the existing issues ### Current Behavior Divide attaches a P2C completion callback to the initially selected upstream. During failover, `DefaultRetryStrategy.resend` selects another upstream through `LoadbalancerUtils.getForExchange`. With at least two retry candidates, this enters P2C's `doSelect` and increments the new upstream's inflight counter. The retry request is wrapped for circuit-breaker outcome accounting, but no P2C completion callback releases the retry upstream's increment. The outer Divide callback still captures the initial upstream. Repeated failovers therefore inflate counters on retry destinations and distort subsequent load estimates. ### Expected Behavior Every actual P2C attempt should have paired accounting on its own selected upstream, including success, failure and cancellation of failover attempts. Avoid double counting or releasing the wrong upstream. ### Steps To Reproduce Proposed HTTP integration scenario (not yet executed end-to-end): 1. Configure Divide with `p2c`, failover retry strategy, at least one retry and at least three healthy upstreams. 2. Make the initially selected upstream fail with a retry-eligible transport error. 3. Leave at least two alternatives after exclusion so the retry takes the P2C multi-candidate path. 4. Let the retry finish successfully, and wait for the outer request to terminate. 5. Inspect the selected retry upstream's inflight counter. It was incremented by P2C selection but has no matching decrement on this request path. 6. Repeat failovers and observe the accumulated overcount. Evidence status: confirmed by source tracing at the commit below; this report does not claim an executed HTTP integration reproduction. ### Anything else? - P2C increment: https://github.com/apache/shenyu/blob/862f5e37e894bd8cef85ef540a8629f313e9ecdf/shenyu-loadbalancer/src/main/java/org/apache/shenyu/loadbalancer/spi/P2cLoadBalancer.java#L73 - Retry selection and forwarding without P2C cleanup: https://github.com/apache/shenyu/blob/862f5e37e894bd8cef85ef540a8629f313e9ecdf/shenyu-plugin/shenyu-plugin-httpclient/src/main/java/org/apache/shenyu/plugin/httpclient/DefaultRetryStrategy.java#L144-L157 - Divide completion callback captures the original upstream: https://github.com/apache/shenyu/blob/862f5e37e894bd8cef85ef540a8629f313e9ecdf/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-divide/src/main/java/org/apache/shenyu/plugin/divide/DividePlugin.java#L198-L209 - Related: #6733 fixed cancellation cleanup for the original forwarding path; the separate failover path still lacks per-attempt cleanup. ### Environment - ShenYu: master, 2.7.2-SNAPSHOT - Commit: `862f5e37e894bd8cef85ef540a8629f313e9ecdf` - Java 17 -- 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]
