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

connections.total-connections count can get negative #351

Closed
mikkokar opened this issue Nov 27, 2018 · 2 comments
Closed

connections.total-connections count can get negative #351

mikkokar opened this issue Nov 27, 2018 · 2 comments
Labels

Comments

@mikkokar
Copy link
Contributor

The problem

Styx connections.total-connections count can get negative.

Detailed description

Most likely culprit is the channelRegistered handler in ExcessConnectionRejector.

@Override
public void channelRegistered(ChannelHandlerContext ctx) throws Exception {
    if (channelGroup.size() >= maxConnectionsCount) {
        LOGGER.warn("Max allowed connection  to server exceeded: current={} configured={}", channelGroup.size(), maxConnectionsCount);
        ctx.close();
        return;
    }
    channelGroup.add(ctx.channel());
    super.channelRegistered(ctx);
}

I suspect calling ctx.close() fromchannelRegistered triggers a channelInactive event without corresponding channelActive. As a result, ChannelStatisticsHandler ends up seeing more channel inactive than channel active events, and the count may drift below zero.

Acceptance criteria

  • A rejected connection is neutral with respect to total-connections count.
@mikkokar mikkokar self-assigned this Nov 27, 2018
@mikkokar
Copy link
Contributor Author

mikkokar commented Nov 27, 2018

Fyi @taer ^^^.

@mikkokar mikkokar added the bug label Nov 27, 2018
@mikkokar mikkokar removed their assignment Dec 7, 2018
kvosper added a commit that referenced this issue Jan 7, 2019
@kvosper
Copy link
Contributor

kvosper commented Jan 7, 2019

Merged #360

@kvosper kvosper closed this as completed Jan 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants