You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by GitBox <gi...@apache.org> on 2019/09/12 04:16:37 UTC
[GitHub] [skywalking] yefei14131 opened a new issue #3466: gent can not
reconnect to the collector when the oap server have only one instance and
has been restarted
yefei14131 opened a new issue #3466: gent can not reconnect to the collector when the oap server have only one instance and has been restarted
URL: https://github.com/apache/skywalking/issues/3466
Please answer these questions before submitting your issue.
- Why do you submit this issue?
- [ ] Question or discussion
- [x] Bug
- [ ] Requirement
- [ ] Feature or performance improvement
___
### Bug
- Which version of SkyWalking, OS and JRE?
version: v6.3.0
- Which company or project?
hualala.com
- What happen?
agent can not reconnect to the collector when the oap server only one instance and has been restarted.
source code in class org.apache.skywalking.apm.agent.core.remote.GRPCChannelManager:
```bash
try {
int index = Math.abs(random.nextInt()) % grpcServers.size();
if (index != selectedIdx) {
selectedIdx = index;
server = grpcServers.get(index);
String[] ipAndPort = server.split(":");
if (managedChannel != null) {
managedChannel.shutdownNow();
}
managedChannel = GRPCChannel.newBuilder(ipAndPort[0], Integer.parseInt(ipAndPort[1]))
.addManagedChannelBuilder(new StandardChannelBuilder())
.addManagedChannelBuilder(new TLSChannelBuilder())
.addChannelDecorator(new AgentIDDecorator())
.addChannelDecorator(new AuthenticationDecorator())
.build();
notify(GRPCChannelStatus.CONNECTED);
reconnect = false;
} else if (managedChannel.isConnected()) {
// Reconnect to the same server is automatically done by GRPC,
// therefore we are responsible to check the connectivity and
// set the state and notify listeners
notify(GRPCChannelStatus.CONNECTED);
reconnect = false;
}
return;
} catch (Throwable t) {
logger.error(t, "Create channel to {} fail.", server);
}
```
the line 102 in class org.apache.skywalking.apm.agent.core.remote.GRPCChannelManager should be channge to :
```bash
if (index != selectedIdx || !managedChannel.isConnected())
```
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services