Repository navigation
msg/async/ProtocolV2: Speed up connection logic when peer restarts & Added Netsplit Grace Period - #64122
Conversation
6b91097 to
df9255a
Compare
df9255a to
9344158
Compare
|
Clone of #63413, which was merged too early. |
Not exact clone since the solution is different now 😅, but yes tackling the same problem! |
|
Testing this against rados:monthrash lets see how it performs: |
|
there are 2 failures out of 30 ... investigating. I know why we had the failures ... (EDIT, I just corrected the PR to check for peer_global_seq=1 instead of peer_global_seq=0, in the server side) This is because when we do ProtocolV2::start_client_banner_exchange() we are actually incrementing global_seq since Therefore, the server should check for peer_global_seq == 1, instead since there is no way the server will get peer_global_seq == 0 from the client since they have to start_client_banner_exchange() in which the client side will increment the global_seq to 1 even if it is freshly started |
| if (peer_global_seq == 0 && | ||
| exproto->client_cookie && client_cookie && | ||
| exproto->client_cookie != client_cookie) { | ||
| ldout(cct, 1) << __func__ << " client has clearly restarted (global_seq=0, cookie changed), " |
There was a problem hiding this comment.
Yeah, for the client-reset case we aren't choosing the reconnect path as the server_cookie should be zero.
CtPtr ProtocolV2::start_session_connect() {
if (!server_cookie) {
ceph_assert(connect_seq == 0);
state = SESSION_CONNECTING;
return send_client_ident();
} else { // reconnecting to previous session
state = SESSION_RECONNECTING;
ceph_assert(connect_seq > 0);
return send_reconnect();
}
}A client restart (in contrast to a connection reset alone) thrashes the entire state-at-client. I don't see business in trying to ressurrect the exproto in such conditions. @idryomov, what do you think?
e07dffa to
854fe32
Compare
|
Will run 1 more test once we finished building in shaman with the new code |
|
jenkins test make check arm64 |
1 similar comment
|
jenkins test make check arm64 |
3496db3 to
435c56e
Compare
|
Just pushed some new changes, hopefully this should pass all tests now, my initial understanding of how AsyncMessenger and ProtocolV2 was flawed. What we can do instead is compare the current global_seq number of a client against the existing global_seq number that the server has saved for that client. Therefore, on the server side apart from seeing a cookie mismatch between the client's previous and current connection, we can just check "peer_global_seq < exproto->peer_global_seq" , since global_seq should only increase during a |
435c56e to
976981c
Compare
|
jenkins test make check |
|
jenkins test api |
| @@ -12,3 +12,4 @@ overrides: | |||
| debug monc: 10 | |||
| log-ignorelist: | |||
| - \(OSD_SLOW_PING_TIME | |||
| - \(MON_NETSPLIT) | |||
| @@ -560,7 +564,9 @@ void Elector::ping_check(int peer) | |||
| } | |||
| } | |||
|
|
|||
| dout(30) << "schedule " << __func__ << " against peer: "<< peer << dendl; | |||
| dout(30) << "Scheduling next ping_check for peer " | |||
There was a problem hiding this comment.
Hmm, 30 is a bit unusual and its existence might be missed (people intuitively assume 20 as the "most verbose" IMHO). On the other hand, it's not new... – fine.
| __u32 updated_to = 0; | ||
| bool did_update_to_old = false; | ||
|
|
||
| { // acquire lock |
|
Let's bake this in |
|
jenkins test make check |
In ProtocolV2::send_server_ident(), the global_seq was being fetched from messenger->get_global_seq() and used in the ServerIdentFrame, however, it is stored in a local var and not the private class var ProtocolV2::global_seq. This causes problems like where the receiving peer sees a peer_global_seq that appears older than expected, triggering a false-positive reconnect logic: ``` 2025-07-15T11:40:50.927+0000 mon.c handle_existing_connection client has clearly restarted (peer_global_seq < ex_peer_global_seq && cookie changed), dropping existing connection=0x563ffe9a9000 in favor of new one ``` In this case, mon.c received a peer_global_seq=75, which was already logged by mon.d as gs=79 in its send_server_ident()—but ProtocolV2::global_seq was never updated, resulting in inconsistent state and premature connection teardown. This commit fixes the issue by assigning the freshly incremented messenger->get_global_seq() value to the local global_seq field in ProtocolV2 as well, ensuring consistency in the protocol. Fixes: https://tracker.ceph.com/issues/71344 Signed-off-by: Kamoltat Sirivadhna <[email protected]>
Some existing netsplit test in 3az + stretch mode needed white listing and check for netsplit details Make qa/tasks/mon_thrash.py set mon_netsplit_grace_period to 30 seconds when we try to freeze monitors instead of killing them. Make qa/tasks/stretch_mode_disable_enable.py set mon_netsplit_grace_period to 30 seconds during `teardown` phase only. Fixes: https://tracker.ceph.com/issues/71344 Signed-off-by: Kamoltat Sirivadhna <[email protected]>
Update the MON_NETSPLIT health check documentation to reflect the introduction of the configurable mon_netsplit_grace_period option. Fixes: https://tracker.ceph.com/issues/71344 Signed-off-by: Kamoltat Sirivadhna <[email protected]>
53d4c2c to
5ee0bbf
Compare
|
This pull request can no longer be automatically merged: a rebase is needed and changes have to be manually resolved |
|
@kamoltat - The PR has been tested. Please feel free to merge it after resolving the configuration changes check. |
The new config was documented here: https://github.com/ceph/ceph/pull/64122/files#diff-47d8f55f7cd60b595629a31ccc8284c87adf4d44c15d5c84966db2a6ddec8e4d I'm going to dismiss the bot. |
|
/config check ok |
|
Let's bake this in |
|
I hope the & in the title doesn't cause problems. I've seen non-alphanumerics cause problems in e.g. release note formatting in the past. |
When a client restarts, it loses its state including global_seq and
gets a new client_cookie. This creates an issue during reconnection
because the server has an existing connection with a higher
global_seq value, causing it to reject the new connection as "stale"
with the error:
"this is a stale connection, peer_global_seq="
This commit adds detection logic in
ProtocolV2::handle_existing_connection() to identify client restarts
by checking:
When all three conditions are met, the server drops the existing connection
and accepts the new one. This leads to faster reconnection, especially
in cases like Monitor restarts, helping clients rejoin the quorum
without delay and avoiding spurious MON_NETSPLIT warnings.
It also prevents reliance on server-side reconnect attempts or waiting
for the client's global_seq to catch up.
Note: without this patch, it'll take longer
for the reconnection to happen, eventually the server will
also act as a client and send_reconnect since it has server_cookie.
However, this could be 15 seconds later, since, the server probably
was hit with a _fault max_back_off when it was trying to connect
to the client when the client was still down and has not yet
restart. This patch basically does not wait for the reconnection
to happen and intelligently make decisions in dropping existing
connection or not based on 3 conditions.
Fixes: https://tracker.ceph.com/issues/71344
Note: Originally raised as #63413, but this one was merged prematurely and was reverted in #64047.
Contribution Guidelines
To sign and title your commits, please refer to Submitting Patches to Ceph.
If you are submitting a fix for a stable branch (e.g. "quincy"), please refer to Submitting Patches to Ceph - Backports for the proper workflow.
When filling out the below checklist, you may click boxes directly in the GitHub web UI. When entering or editing the entire PR message in the GitHub web UI editor, you may also select a checklist item by adding an
xbetween the brackets:[x]. Spaces and capitalization matter when checking off items this way.Checklist
Show available Jenkins commands
jenkins test classic perfJenkins Job | Jenkins Job Definitionjenkins test crimson perfJenkins Job | Jenkins Job Definitionjenkins test signedJenkins Job | Jenkins Job Definitionjenkins test make checkJenkins Job | Jenkins Job Definitionjenkins test make check arm64Jenkins Job | Jenkins Job Definitionjenkins test submodulesJenkins Job | Jenkins Job Definitionjenkins test dashboardJenkins Job | Jenkins Job Definitionjenkins test dashboard cephadmJenkins Job | Jenkins Job Definitionjenkins test apiJenkins Job | Jenkins Job Definitionjenkins test docsReadTheDocs | Github Workflow Definitionjenkins test ceph-volume allJenkins Jobs | Jenkins Jobs Definitionjenkins test windowsJenkins Job | Jenkins Job Definitionjenkins test rook e2eJenkins Job | Jenkins Job Definition