Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

agent can not reconnect to the collector when the oap server have only one instance and has been restarted #3466

Closed
1 of 4 tasks
yefei14131 opened this issue Sep 12, 2019 · 2 comments
Labels
question End user question and discussion.
Milestone

Comments

@yefei14131
Copy link

Please answer these questions before submitting your issue.

  • Why do you submit this issue?
  • Question or discussion
  • 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:

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 :

if (index != selectedIdx || !managedChannel.isConnected())
@yefei14131 yefei14131 changed the title gent can not reconnect to the collector when the oap server have only one instance and has been restarted agent can not reconnect to the collector when the oap server have only one instance and has been restarted Sep 12, 2019
@kezhenxu94
Copy link
Member

Duplicate of #3366

@kezhenxu94 kezhenxu94 marked this as a duplicate of #3366 Sep 12, 2019
@kezhenxu94
Copy link
Member

The bug should be fixed in 6.3.0, #3181 and #3240 @yefei14131

@kezhenxu94 kezhenxu94 added the question End user question and discussion. label Sep 12, 2019
@kezhenxu94 kezhenxu94 added this to the 6.5.0 milestone Sep 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question End user question and discussion.
Projects
None yet
Development

No branches or pull requests

2 participants