pujitha24 commented on PR #3757: URL: https://github.com/apache/dubbo-go/pull/3757#issuecomment-6105580289
Without it, every `Dial` shares the client's single `overallReference` pointer, because `setReference` assigns it straight into `opts.Reference`. `WithRequestTimeout` then writes `RequestTimeout` onto that shared object. So after `Dial(..., WithRequestTimeout(500ms))`, a later `Dial` with no option would still see "500ms" and the new "reference timeout wins over consumer" check in `action.go` would apply it to the wrong reference, instead of falling back to the consumer timeout. Cloning per dial gives each reference its own copy. `TestDialRequestTimeoutDoesNotLeakAcrossDials` in `action_test.go` dials twice in a row (500ms, then no option) and expects "3s" the second time. I only reasoned through the sharing from the code and that test; I didn't separately run the test with the Clone removed. -- 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]
