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

Wrong tcp connection probe registration in outgoing member connection #13768

jerrinot opened this issue Sep 14, 2018 · 2 comments

Wrong tcp connection probe registration in outgoing member connection #13768

jerrinot opened this issue Sep 14, 2018 · 2 comments


Copy link

@jerrinot jerrinot commented Sep 14, 2018

When a member opens a new connection to another member tcp.connection probes are registered as tcp.connection[null->null].out.writeQueueSize. Notice there is [null->null] instead of [address->address]

It's because at the time when a connection is registered then the connection is not established yet hence channel.localSocketAddress and channel.remoteSocketAddress() return false.

The channel is created (and registered)here, but the connection is opened and few lines bellow

@jerrinot jerrinot added this to the 3.11 milestone Sep 14, 2018
@jerrinot jerrinot changed the title Wrong tcp connection probe registration Wrong tcp connection probe registration in outgoing member connection Sep 14, 2018
Copy link
Contributor Author

@jerrinot jerrinot commented Sep 14, 2018

    public static void main(String[] args) {
        HazelcastInstance instance = HazelcastClient.newHazelcastClient();
        HazelcastClientProxy i = (HazelcastClientProxy) instance;
        MetricsRegistryImpl metricsRegistry = i.client.getMetricsRegistry();

        for (;;) {
            Set<String> names = metricsRegistry.getNames();


there is something similar going on with client connection probes: tcp.connection[/0:0:0:0:0:0:0:0:55065->null].out.writeQueueSize

Copy link

@pveentjer pveentjer commented Sep 14, 2018

This can easily be fixed by moving registration:

    public Channel register(SocketChannel socketChannel, boolean clientMode) throws IOException {
        NioChannel channel = new NioChannel(socketChannel, clientMode, channelInitializer);


        NioInboundPipeline inboundPipeline = newInboundPipeline(channel);
        NioOutboundPipeline outboundPipeline = newOutboundPipeline(channel);


        channel.init(inboundPipeline, outboundPipeline);

        String metricsId = channel.localSocketAddress() + "->" + channel.remoteSocketAddress();
        metricsRegistry.scanAndRegister(outboundPipeline, "tcp.connection[" + metricsId + "].out");
        metricsRegistry.scanAndRegister(inboundPipeline, "tcp.connection[" + metricsId + "].in");

        ioBalancer.channelAdded(inboundPipeline, outboundPipeline);

        return channel;

To the connect method. I'll create a PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

3 participants
You can’t perform that action at this time.