-
Type:
Bug
-
Resolution: Fixed
-
Priority:
Major - P3
-
Affects Version/s: None
-
Component/s: None
-
None
-
Server Security
-
Fully Compatible
-
ALL
-
Server Security 2026-08-14, Server Security 2026-08-28
-
200
-
None
-
None
-
None
-
None
-
None
-
None
-
None
Overview
Two defects surfaced by BF-45616. A transient client-side gRPC TLS "Failed to create security
handshaker" error is classified non-retryable, so SLSConfigManager's constructor throws on the
first attempt and the uncaught exception reaches std::terminate during mongod startup. A
missing SIGKILL escalation in killPyKMIPServer then turned that 200ms crash into a 26-minute
task timeout.
This is a recurrence of SERVER-130172, which fixed one producer of the error string but left the
classification – the thing that ticket's own description identifies as "the bug" – unchanged.
The TLS handshaker error occurs when gRPC's internal handshaker factory (the object it builds
from the client certificate) is not present at the moment a connection attempt requests a
handshaker. The client certificate itself has been loaded and validated by this point; it is the
gRPC-internal object derived from it that is missing. The window that leaves it missing has not been
identified, and gRPC provides no mechanism to wait for the factory (there is an unimplemented
upstream TODO for exactly this). A real fix would therefore involve changes to the third-party gRPC
library, and we do not want to manage a fork of that package if we can possibly avoid it.
Background
On BF-45616 (disagg_storage on linux-64-debug-disagg-required @ 099bd8cd, test
ese_cmk_identifier_list_commands.js), mongod aborted with exit code 6 ~38ms after process
start, on ctx:"main", before listener setup:
DBException::toString(): CommandFailed: Failed to run getLogSegmentList for log ID 2 on cell
metadata server at 172.17.0.1:20741 :: caused by :: grpcStatus: (code: 14: message: failed to
connect to all addresses; last error: UNKNOWN: ipv4:172.17.0.1:20741: Failed to create security
handshaker.)
This is not a CMS-readiness race: the cell metadata server had been listening for 5.7s, reported
SERVING 4.6s earlier, the test shell itself made the identical GetLogSegmentList gRPC call to
the same address successfully 1.1s earlier, and the CMS accepted another mTLS connection 2ms after
mongod's failure. resolveCredentials also succeeded – no InvalidSSLConfiguration uassert
fired, so all three cert files were read and ValidateCredentials() passed. The certs were
valid; the handshaker factory simply was not available for the first RPC.
git merge-base confirms the SERVER-130172 fix (75920d3d74c) was present in the failing build.
Details – defect 1 (crash)
CMSStatus::_is_handshake_error() substring-matches the error text, and
is_cms_unavailable_error() uses that to force retryable = false, even though the gRPC status
code is 14 (UNAVAILABLE), which would otherwise be retryable:
bool is_cms_unavailable_error() const { return ((error_code() == grpc::StatusCode::UNAVAILABLE) && (!_is_handshake_error())) || cms_error_matches(cellmetadata::v1::ERROR_CODE_NOT_PRIMARY); }
extendConfigWithZoneInfo then short-circuits on !err.retryable without ever consulting
cellMetadataServerTimeoutSecs, so {{LOGV2_WARNING(11560801, "CMS didn't return a segment list
yet, retrying.")}} never fires. The log confirms exactly one attempt was made.
The resulting uassertStatusOK throws from a constructor with no handler above it –
SLSConfigManager() <- StateMachine::StateMachine <-
initializeStateRequiredForStorageAccess <- setUpReplication <- mongod_main has no
try/catch anywhere on the path – so the exception escapes to main and aborts.
Details – defect 2 (teardown hang)
On POSIX, killPyKMIPServer sends SIGINT and blocks in stopMongoProgramByPid with no timeout
and no SIGKILL escalation. The PyKMIP mock (pid 94108) never exited – plausibly because the mongod
that SIGABRTed mid-session left a half-open TLS connection on it. The shell's last line was
"Waiting for process to terminate." at 18:17:02, and nothing followed until Evergreen's idle
timeout at 18:43:11.
This is why BF-45616 is a task-timed-out rather than a normal test failure, and it is
independent of disagg storage – it affects every ESE/KMIP test.
Scope of Work
- src/mongo/db/modules/atlas/src/disagg_storage/pali/cell_metadata_service_util.cpp – make
handshake errors retryable under a small bounded budget (a few attempts, or a short deadline
distinct from cellMetadataServerTimeoutSecs) instead of non-retryable. - src/mongo/db/modules/atlas/src/disagg_storage/pali/cell_metadata_service_util.h –
is_cms_unavailable_error classification. - src/mongo/db/modules/enterprise/jstests/encryptdb/libs/helpers.js – bounded wait after
SIGINT, then SIGKILL, in killPyKMIPServer.
Acceptance Criteria
- A transient handshake failure at startup is retried and mongod starts successfully.
- A genuinely misconfigured TLS setup still fails fast rather than looping forever –
src/mongo/db/modules/atlas/jstests/disagg_storage/pali/invalid_tls_settings.js still passes,
with adjusted expected timing but the same expected outcome. - killPyKMIPServer always returns within a bounded time even when the child ignores SIGINT.
Technical Notes
- Consider splitting the two strings in possibleErrorMsgs into separate categories.
TSI_DATA_CORRUPTED is arguably a genuine-corruption signal that should stay non-retryable,
whereas "Failed to create security handshaker" is the one the code cannot distinguish from a
transient window. - The fix does not require first identifying which gRPC internal produced the string. The
classification is the defect regardless of the producer. - This ticket was originally filed with the hypothesis that gRPC's certificate distributor delivers
asynchronously relative to the first RPC even with StaticDataCertificateProvider, leaving
TlsChannelSecurityConnector::client_handshaker_factory_ null. That hypothesis is wrong –
delivery on that path is synchronous within the security connector's constructor. See the gRPC
investigation comment below for what was verified, why fixing the race at its source is not
currently actionable, and a recommended follow-up to make the next occurrence diagnosable. The
window that actually leaves the factory null has not been identified. - The comment in _is_handshake_error refers to invalid_tls_setting.js; the actual file is
invalid_tls_settings.js. Worth correcting while in there. - Separately, initializeStateRequiredForStorageAccess / setUpReplication in
mongod_main should not reach std::terminate on a startup config failure. Filing that
separately as a startup-robustness improvement is reasonable if it's out of scope here. - BF-44725 (2026-07-16, key_rotation_with_writes.js) hit the identical failure with a
different, non-ESE cert fixture, so this is a general disagg-storage TLS startup problem rather
than an ESE/CMK-specific one. - Task failure rate on this required variant was 9/100 dispatched runs (2026-07-13 to 2026-08-07).
The true crash rate is likely understated: a Build Baron auto-resolution rule keyed on
SLSConfigManager::SLSConfigManager / StateMachine::StateMachine auto-closes occurrences
as Duplicate against BF-44283, which is itself Closed/Fixed. BF-45616 only surfaced because
defect 2 changed its task-level signature to task-timed-out. That rule should be retired
(Build Baron / DEVPROD, no code).
- related to
-
SERVER-139826 Disagg mongod stuck forever with 'Failed to create security handshaker' to SLS after one startup
-
- Needs Scheduling
-