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

Fix iInFlightTCPPings check #4123

Merged
merged 2 commits into from
May 19, 2020

Conversation

Profpatsch
Copy link

The iInFlightTCPPings >= g.s.iMaxInFlightTCPPings check would mean
that if 1 is in flight and another is started, it immediately
disconnects, so as OP said in
#3448 we want to have >
here.

Maybe that already fixes most of the spurious disconnects in practice,
or maybe we want to increase the default to 3 (right now it’s
effectively 2−1, so 1).

Fixes: #3448

Copy link
Member

@Krzmbrzl Krzmbrzl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay I just made myself (more or less) familiar with how the system seems to work.

The value of iInFlightTCPPings is checked at

if (g.s.iMaxInFlightTCPPings >= 0 && iInFlightTCPPings >= g.s.iMaxInFlightTCPPings) {
serverConnectionClosed(QAbstractSocket::UnknownSocketError, tr("Server is not responding to TCP pings"));
return;
}

which is in the same function that'll also send a new ping. This means that if the maximum is reached (iInFlighttcppings == iMaxInFlightTCPPings), the connection should be terminated as otherwise it'd send another ping and via

iInFlightTCPPings += 1;

iInFlightTCPPings would be increased by one and thus exceeding the maximum value. Thus the current implementation seems to be correct.

However when looking at the documentation of iMaxInFlightTCPPings at

/// iMaxInFlightTCPPings specifies the maximum
/// number of ping messages that the client has
/// sent, but not yet recieved a response for
/// from the server. This value is checked when
/// the client sends its next ping message. If
/// the maximum is reached, the connection will
/// be closed.
/// If this setting is assigned a value of 0 or
/// a negative number, the TCP ping check is
/// disabled.
int iMaxInFlightTCPPings;

I agree with @radistmorse that the checking should actually be

if (g.s.iMaxInFlightTCPPings > 0 && iInFlightTCPPings >= g.s.iMaxInFlightTCPPings) {

(> instead of >= for checking the setting) as otherwise the TCP ping check would be done also if iMaxInFlightTCPPings == 0 which contradicts its documentation.
Thus this should be changed accordingly.

To address your initial concern, I think you can safely increase the default value for iMaxInFlightTCPPings by one (effectively having the same effect as the current state of this PR).

@Krzmbrzl Krzmbrzl added the client label May 3, 2020
@Krzmbrzl
Copy link
Member

@Profpatsch what's the status? Will you change the PR accordingly or should someone else overtake that?

@Profpatsch
Copy link
Author

I don’t understand your comment fully, so please go ahead and push the changes onto the PR. I’m getting regular disconnects on perfectly fine connections here, so I’d just like it solved.

I already increased the value by 1 in my config and it still disconnects sometimes, so I wonder if the default shouldn’t be 3 or even 5.

How often are these pings sent, aka how much timeout would each increase of the option cause?

According to the documentation of Settings::IMaxInFlightTCPPings, a
value of 0 should disable the check. That was not the case though which
is corrected by this commit.
@Krzmbrzl
Copy link
Member

How often are these pings sent, aka how much timeout would each increase of the option cause?

In the default configuration they are sent every 5 seconds.

…ings to 4

We have received reports about users getting disconnects even though
their network was fine (mumble-voip#3448). By increasing this limit by default, we
should be able to circumvent that.
@Krzmbrzl Krzmbrzl force-pushed the fix-inFlightTCPPings-check branch from 8024d10 to 7251c30 Compare May 17, 2020 17:05
@Krzmbrzl
Copy link
Member

I added the respective changes and increased the allowed in-flight ping count to 4

@Krzmbrzl Krzmbrzl changed the title src/mumble/ServerHandler.cpp: fix iInFlightTCPPings check (>= -> >) Fix iInFlightTCPPings check May 17, 2020
@Krzmbrzl Krzmbrzl merged commit 2504f97 into mumble-voip:master May 19, 2020
Krzmbrzl added a commit that referenced this pull request May 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TCP pings are bugged
2 participants