- [ ] I have searched the [issues](https://github.com/apache/dubbo/issues) of
this repository and believe that this is not a duplicate.
- [ ] I have checked the
[FAQ](https://github.com/apache/dubbo/blob/master/FAQ.md) of this repository
and believe that this is not a duplicate.
### Environment
* Dubbo version: 2.7.3
* Operating System version: macOs Sierra
* Java version: Jdk 1.8
### Steps to reproduce this issue
1. start two provider (A and B)
2. start one consumer with lazy connection
3. pull out A provider
The old invoker will be destroyed, including the connection.
ReferenceCountExchangeClient will replace a new lazy connection with
LAZY_CONNECT_INITIAL_STATE_KEY=false.
```
private void replaceWithLazyClient() {
URL lazyUrl = URLBuilder.from(url)
.addParameter(LAZY_CONNECT_INITIAL_STATE_KEY, Boolean.FALSE)
.addParameter(RECONNECT_KEY, Boolean.FALSE)
.addParameter(SEND_RECONNECT_KEY, Boolean.TRUE.toString())
.addParameter("warning", Boolean.TRUE.toString())
.addParameter(LazyConnectExchangeClient.REQUEST_WITH_WARNING_KEY, true)
.addParameter("_client_memo",
"referencecounthandler.replacewithlazyclient")
.build();
```
4. pull in A provider
DubboProtocol will get shared clients for A provider. And the checkClientCanUse
returns available after PR: #5531 , which caused invokers returns not avilable
as LAZY_CONNECT_INITIAL_STATE_KEY be replaced to FALSE.
```
private List<ReferenceCountExchangeClient> getSharedClient(URL url, int
connectNum) {
String key = url.getAddress();
List<ReferenceCountExchangeClient> clients =
referenceClientMap.get(key);
if (checkClientCanUse(clients)) {
batchClientRefIncr(clients);
return clients;
}
```
ReferenceConfig createProxy will throw exception, as the connection is not
available.
```
if (shouldCheck() && !invoker.isAvailable()) {
throw new IllegalStateException("Failed to check the status of the
service "
}
```
Pls. provide [GitHub address] to reproduce this issue.
### Expected Result
Replaced connection should be avilable.
### Actual Result
Replaced connection is not avilable.
[ Full content available at: https://github.com/apache/dubbo/issues/5673 ]
This message was relayed via gitbox.apache.org for
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]