Repository navigation
[DNM] ProtocolV2: make handle_existing_connection check for cookie mismatch first - #63413
Conversation
a4d76bd to
d47fb94
Compare
Config Diff Tool Output- removed: breakpad
! changed: rgw_sts_key: old: Key used for encrypting/ decrypting role session tokens. This key must consist of 16 hexadecimal characters, which can be generated by the command 'openssl rand -hex 16'. All radosgw instances in a zone should use the same key. In multisite configurations, all zones in a realm should use the same key.
! changed: rgw_sts_key: new: Key used for encrypting/ decrypting session token.
! changed: osd_scrub_max_interval: old: Scrub each PG no less often than this interval. Note that this option must be set at ``global`` scope, or for both ``mgr`` and``osd``.
! changed: osd_scrub_max_interval: new: Scrub each PG no less often than this interval
! changed: osd_scrub_min_interval: old: The desired interval between scrubs of a specific PG. Note that this option must be set at ``global`` scope, or for both ``mgr`` and``osd``.
! changed: osd_scrub_min_interval: new: The desired interval between scrubs of a specific PG.
! changed: osd_deep_scrub_interval: old: Deep scrub each PG (i.e., verify data checksums) at least this often. Note that this option must be set at ``global`` scope, or for both ``mgr`` and``osd``.
! changed: osd_deep_scrub_interval: new: Deep scrub each PG (i.e., verify data checksums) at least this often
! changed: osd_deep_scrub_interval_cv: old: The coefficient of variation for the deep scrub interval, specified as a ratio. On average, the next deep scrub for a PG is scheduled osd_deep_scrub_interval after the last deep scrub . The actual time is randomized to a normal distribution with a standard deviation of osd_deep_scrub_interval * osd_deep_scrub_interval_cv (clamped to within 2 standard deviations). The default value guarantees that 95% of deep scrubs will be scheduled in the range [0.8 * osd_deep_scrub_interval, 1.2 * osd_deep_scrub_interval].
! changed: osd_deep_scrub_interval_cv: new: The coefficient of variation for the deep scrub interval, specified as a ratio. On average, the next deep scrub for a PG is scheduled osd_deep_scrub_interval after the last deep scrub . The actual time is randomized to a normal distribution with a standard deviation of osd_deep_scrub_interval * osd_deep_scrub_interval_cv (clamped to within 2 standard deviations). The default value guarantees that 95% of the deep scrubs will be scheduled in the range [0.8 * osd_deep_scrub_interval, 1.2 * osd_deep_scrub_interval].
! changed: osd_deep_scrub_interval_cv: old: deep scrub intervals are varied by a random amount to prevent stampedes. This parameter determines the amount of variation. Technically ``osd_deep_scrub_interval_cv`` is the coefficient of variation for the deep scrub interval.
! changed: osd_deep_scrub_interval_cv: new: deep scrub intervals are varied by a random amount to prevent stampedes. This parameter determines the amount of variation. Technically - osd_deep_scrub_interval_cv is the coefficient of variation for the deep scrub interval.
The above configuration changes are found in the PR. Please update the relevant release documentation if necessary. |
Problem: When a monitor daemon (e.g., mon.c) is killed and restarts, its attempt to re-establish a session with a peer (mon.a) is incorrectly rejected. This happens because mon.a retains stale connection state, including a higher peer_global_seq, from the previous session. When the newly restarted mon.c sends a ClientIdentFrame with a fresh client_cookie and a low global_seq (e.g., 1), mon.a compares this against the old connection’s peer_global_seq (e.g., 61) and mistakenly concludes that the connection is stale. As a result, mon.a terminates the incoming connection from mon.c, delaying session recovery and triggering a transient MON_NETSPLIT warning. The connection is only recovered once mon.a's backoff timer expires and it initiates a new connection to mon.c. Solution: Reorder the logic in handle_existing_connection so that the check for client_cookie mismatch is performed before the global_seq comparison. This leverages the existing code path that handles session resets and restarts when a peer has generated a new client_cookie (e.g., after a daemon restart). By bumping this condition earlier, we avoid incorrectly rejecting valid new connections as "stale" and instead allow proper session negotiation to proceed. This change prevents unnecessary connection drops and eliminates the transient MON_NETSPLIT in such restart scenarios. Fixes: https://tracker.ceph.com/issues/71344 Signed-off-by: Kamoltat Sirivadhna <[email protected]>
Fixes: https://tracker.ceph.com/issues/71344 Signed-off-by: Kamoltat Sirivadhna <[email protected]>
d47fb94 to
93e15e3
Compare
|
jenkins test api |
|
jenkins test windows |
|
jenkins test make check |
|
jenkins test make check arm64 |
|
Note a problem in the output of the Config Diff Tool |
|
Is it safe to default the mon log to 30 in all regular (debug) vstarts? |
|
Note that compilations fail due to: |
Fixes: https://tracker.ceph.com/issues/71344 Signed-off-by: Kamoltat Sirivadhna <[email protected]>
bump mon debug level to 30 in RADOS and bump debug_ms from mon in monthtrash test suites. Fixes: https://tracker.ceph.com/issues/71344 Signed-off-by: Kamoltat Sirivadhna <[email protected]>
Make debug_mon = 30 a default for mons in vstart cluster verbose mode. Fixes: https://tracker.ceph.com/issues/71344 Signed-off-by: Kamoltat Sirivadhna <[email protected]>
@ronen-fr |
93e15e3 to
52b9429
Compare
thank you, forgot the "l" in ldout. |
|
Building the branch in Shaman, will schedule a teuthlogy run targeting the mon_thrash suite to check if problem goes away. |
|
jenkins test windows |
| if (connection->policy.resetcheck) { | ||
| exproto->reset_session(); | ||
| } | ||
| return reuse_connection(existing, exproto); |
There was a problem hiding this comment.
I'm afraid this is contrary to the intention behind RetryGlobalFrame:
CtPtr ProtocolV2::handle_reconnect(ceph::bufferlist &payload)
{
// ...
if (exproto->replacing) {
ldout(cct, 1) << __func__
<< " existing racing replace happened while replacing."
<< " existing=" << existing << dendl;
auto retry = RetryGlobalFrame::Encode(exproto->peer_global_seq);
return WRITE(retry, "session retry", read_frame);
}
// ...
if (exproto->peer_global_seq > reconnect.global_seq()) {
ldout(cct, 5) << __func__
<< " stale global_seq: sgs=" << exproto->peer_global_seq
<< " cgs=" << reconnect.global_seq()
<< ", ask client to retry global" << dendl;
auto retry = RetryGlobalFrame::Encode(exproto->peer_global_seq);
INTERCEPT(18);
return WRITE(retry, "session retry", read_frame);
}
Similar machinery is present also in ProtocolV1:
CtPtr ProtocolV1::handle_connect_reply_2() {
// ...
if (connect_reply.tag == CEPH_MSGR_TAG_RETRY_GLOBAL) {
global_seq = messenger->get_global_seq(connect_reply.global_seq);
ldout(cct, 5) << __func__ << " connect got RETRY_GLOBAL "
<< connect_reply.global_seq << " chose new " << global_seq
<< dendl;
return CONTINUE(send_connect_message);
}CtPtr ProtocolV1::handle_connect_message_2() {
// ...
if (existing) {
// ...
if (exproto->replacing) {
ldout(cct, 1) << __func__
<< " existing racing replace happened while replacing."
<< " existing_state="
<< connection->get_state_name(existing->state) << dendl;
reply.global_seq = exproto->peer_global_seq;
existing->lock.unlock();
return send_connect_message_reply(CEPH_MSGR_TAG_RETRY_GLOBAL, reply,
authorizer_reply);
}
if (connect_msg.global_seq < exproto->peer_global_seq) {
ldout(cct, 10) << __func__ << " accept existing " << existing << ".gseq "
<< exproto->peer_global_seq << " > "
<< connect_msg.global_seq << ", RETRY_GLOBAL" << dendl;
reply.global_seq = exproto->peer_global_seq; // so we can send it below..
existing->lock.unlock();
return send_connect_message_reply(CEPH_MSGR_TAG_RETRY_GLOBAL, reply,
authorizer_reply);
} else {
ldout(cct, 10) << __func__ << " accept existing " << existing << ".gseq "
<< exproto->peer_global_seq
<< " <= " << connect_msg.global_seq << ", looks ok"
<< dendl;
}A question that is bugging me: why the V2's reconnect path is, apparently, never taken for those problematic connections?
There was a problem hiding this comment.
@kamoltat: have you even seen the problem on a non-lossy connection?
There was a problem hiding this comment.
@kamoltat: the fragment I meant during the core sync is:
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();
}
} There was a problem hiding this comment.
I'm afraid this is contrary to the intention behind
RetryGlobalFrame
Yeah, reordering peer_global_seq and client_cookie checks like that is likely to mess with MDS sessions.
@yuriw I see wip-yuri-testing label. This PR would need to go through the FS suite, preferably more than once.
There was a problem hiding this comment.
@kamoltat: the link with the lossy connections seems to be this:
CtPtr ProtocolV2::send_server_ident() {
ldout(cct, 20) << __func__ << dendl;
// this is required for the case when this connection is being replaced
out_seq = discard_requeued_up_to(out_seq, 0);
in_seq = 0;
if (!connection->policy.lossy) {
server_cookie = ceph::util::generate_random_number<uint64_t>(1, -1ll);
}|
@rzarzynski In the scenario where the client is coming back to the quorum, client does not call send_reconnect() simply because it doesn't have the On the flip side, this is when we finally established the connection. The All in all this leads me to think that maybe we should instead look at the logic here: Maybe we look at more things rather than just (!server_cookie) |
|
Ah thanks for the Approval @shraddhaag, we are currently still exploring other solutions since as discussed with @rzarzynski , this one might not be the best. Holding off merging for now. |
|
Yikes, I guess we need to revert now lol. |
…mismatch first" Revert Commits of PR: ceph#63413 Fixes: https://tracker.ceph.com/issues/71747 Signed-off-by: Kamoltat Sirivadhna <[email protected]>
Problem:
Solution:
Fixes: https://tracker.ceph.com/issues/71344
Signed-off-by: Kamoltat Sirivadhna [email protected]
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