Skip to content

[release-7.4] Forward-port stale peer fixes (storage server, commit/grv proxy) - #13912

Merged
spraza merged 1 commit into
apple:release-7.4from
spraza:port-7.4-stalepeer-combined
Aug 20, 2026
Merged

spraza merged 1 commit into
apple:release-7.4from
spraza:port-7.4-stalepeer-combined

Conversation

@spraza

@spraza spraza commented Aug 19, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Forward-ports the stale-peer connection-timeout fixes from release-7.3 to release-7.4.

Ported from:

Squashed into a single commit here, applied in that order since #13643 depends on the invalidateCacheByAddress path #13367 introduced.

What it does

Client processes can keep stale RequestStream references to dead storage-server/proxy peers (via DatabaseContext::locationCache and MonitorLeader::shrinkProxyList's sampled subset), causing connection-timeout churn. Adds opt-in draining of dead-peer connections: a per-DatabaseContext peer evictor driven by a persistent per-address connect-failed counter, a shrinkProxyList cache clear below the connection cap, eager proxy rebuild on clientInfo change, and an InterfaceTracker observability layer (all gated by knobs, default off in production). invalidateCacheByAddress(es) processes ranges in chunks and yields between chunks to avoid hogging the event loop on large caches. Includes StalePeerTest, a deterministic repro workload.

Conflicts resolved during the port

release-7.4 had already diverged from 7.3 in ways that touch the same files:

  • tests/CMakeLists.txt, fdbclient/NativeAPI.actor.cpp, fdbclient/include/fdbclient/CommitProxyInterface.h, fdbrpc/include/fdbrpc/FlowTransport.h, fdbserver/SimulatedCluster.actor.cpp -- 7.4 additions kept alongside the ported code (no functionality dropped from either side).
  • fdbclient/include/fdbclient/StorageServerInterface.h -- kept 7.4's simplified serialize() (which already dropped old protocol-version branching) and inserted only the InterfaceTracker hook into it.

Fixes made beyond a straight port

  1. StalePeerTest.toml tuning for 7.4. release-7.4 weights simulation storage-engine selection heavily toward RocksDB-family engines (PROBABILITY_FACTOR_SHARDED_ROCKSDB_ENGINE_SELECTED_SIM=100, a knob that doesn't exist on 7.3; PROBABILITY_FACTOR_ROCKSDB_ENGINE_SELECTED_SIM went from 2 on 7.3 to 100 on 7.4). ShardedRocksDB's slower post-kill shard relocation occasionally exceeded the test's original 60s waitAfterKill window -- unrelated to the stale-peer eviction logic itself, which was confirmed working correctly via trace analysis (it detects and re-evicts every 5s; DD relocation was just slow to complete). Excluded SHARDED_ROCKSDB (storageEngineExcludeTypes = [5], same precedent as tests/fast/DDPipelineSaturation.toml) and bumped waitAfterKill 60.0 -> 120.0 to absorb the remaining engine-agnostic timing variance.

Testing

  • General 100K, before/after:
    • baseline: 20260813-172150-praza-port-7.4-stalepeer-combined-base-0cc6fb276599316425f4eac6b58f53a1b4412fb8 -- pass=99999/100000
    • ported: 20260813-175001-praza-port-7.4-stalepeer-combined-c54df8b1eedf0d3d348a57cab037ecdf4fb7e64c -- pass=100000/100000
  • StalePeerTest 10K (new test, no baseline counterpart): 20260814-180055-praza-port-7.4-stalepeer-combined-StalePeerTest-058497d3a -- pass=10000/10000 after the two toml fixes above.

@spraza
spraza marked this pull request as ready for review August 19, 2026 21:33
…, grv proxy)

Client processes can keep stale RequestStream references to dead
storage-server/proxy peers (via DatabaseContext::locationCache and
MonitorLeader::shrinkProxyList's sampled subset), causing connection-timeout
churn. Adds opt-in draining of dead-peer connections: a per-DatabaseContext
peer evictor driven by a persistent per-address connect-failed counter, a
shrinkProxyList cache clear below the connection cap, eager proxy rebuild on
clientInfo change, and an InterfaceTracker observability layer (all gated by
knobs, default off in production). invalidateCacheByAddress(es) processes
ranges in chunks and yields between chunks to avoid hogging the event loop
on large caches. Includes StalePeerTest, a deterministic repro workload.

Ported from upstream/release-7.3 PR apple#13367 (51e1c42)
and PR apple#13643 (805c271).
Conflicts resolved in: tests/CMakeLists.txt, fdbclient/NativeAPI.actor.cpp,
fdbclient/include/fdbclient/CommitProxyInterface.h,
fdbclient/include/fdbclient/StorageServerInterface.h,
fdbrpc/include/fdbrpc/FlowTransport.h, fdbserver/SimulatedCluster.actor.cpp.
@spraza
spraza force-pushed the port-7.4-stalepeer-combined branch from 058497d to 2b7ffd7 Compare August 19, 2026 21:33
@foundationdb-ci

This comment has been minimized.

@foundationdb-ci

This comment has been minimized.

@foundationdb-ci

Copy link
Copy Markdown
Contributor

Result of foundationdb-pr-macos-m1 on macOS 14.x

  • Commit ID: 2b7ffd7
  • Duration 0:38:47
  • Result: ✅ SUCCEEDED
  • Error: N/A
  • Build Log terminal output (available for 30 days)
  • Build Workspace zip file of the working directory (available for 30 days)

@foundationdb-ci

This comment has been minimized.

@foundationdb-ci

Copy link
Copy Markdown
Contributor

Result of foundationdb-pr-clang-arm on Linux RHEL 9

  • Commit ID: 2b7ffd7
  • Duration 0:47:32
  • Result: ✅ SUCCEEDED
  • Error: N/A
  • Build Log terminal output (available for 30 days)
  • Build Workspace zip file of the working directory (available for 30 days)

@foundationdb-ci

This comment has been minimized.

@foundationdb-ci

This comment has been minimized.

@foundationdb-ci

Copy link
Copy Markdown
Contributor

Result of foundationdb-pr-clang on Linux RHEL 9

  • Commit ID: 2b7ffd7
  • Duration 1:09:32
  • Result: ✅ SUCCEEDED
  • Error: N/A
  • Build Log terminal output (available for 30 days)
  • Build Workspace zip file of the working directory (available for 30 days)

@foundationdb-ci

Copy link
Copy Markdown
Contributor

Result of foundationdb-pr on Linux RHEL 9

  • Commit ID: 2b7ffd7
  • Duration 1:14:25
  • Result: ✅ SUCCEEDED
  • Error: N/A
  • Build Log terminal output (available for 30 days)
  • Build Workspace zip file of the working directory (available for 30 days)

@foundationdb-ci

This comment has been minimized.

@foundationdb-ci

Copy link
Copy Markdown
Contributor

Result of foundationdb-pr-cluster-tests on Linux RHEL 9

  • Commit ID: 2b7ffd7
  • Duration 1:42:03
  • Result: ✅ SUCCEEDED
  • Error: N/A
  • Build Log terminal output (available for 30 days)
  • Build Workspace zip file of the working directory (available for 30 days)
  • Cluster Test Logs zip file of the test logs (available for 30 days)

@foundationdb-ci

This comment has been minimized.

@foundationdb-ci

This comment has been minimized.

@alecgrieser alecgrieser left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM. My main comment is on whether we want to make these new knobs opt-in by default in 7.4, but I could also see giving it a bit more time to bake

Comment thread fdbclient/ClientKnobs.cpp
init( MAX_CLIENT_STATUS_AGE, 1.0 );
init( MAX_COMMIT_PROXY_CONNECTIONS, 5 ); if( randomize && BUGGIFY ) MAX_COMMIT_PROXY_CONNECTIONS = 1;
init( MAX_GRV_PROXY_CONNECTIONS, 3 ); if( randomize && BUGGIFY ) MAX_GRV_PROXY_CONNECTIONS = 1;
init( SHRINK_PROXY_LIST_CLEAR_CACHE_BELOW_THRESHOLD, false ); if( randomize && isSimulated ) SHRINK_PROXY_LIST_CLEAR_CACHE_BELOW_THRESHOLD = deterministicRandom()->coinflip();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

During the original 7.3 PR, we'd discussed that maybe we want to make these on by default in 7.4. I could buy the argument that they haven't yet had enough bake time, and we should hold off on doing that for either 8.0 or a 7.4 patch release.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Sorry missed this earlier. My plan is to turn the knobs on by default in a 7.4 patch release. Want some bake time as you said. In main branch and 8.0, these will be on by default.

@foundationdb-ci

Copy link
Copy Markdown
Contributor

Result of foundationdb-pr-macos on macOS 14.x

  • Commit ID: 2b7ffd7
  • Duration 1:33:42
  • Result: ✅ SUCCEEDED
  • Error: N/A
  • Build Log terminal output (available for 30 days)
  • Build Workspace zip file of the working directory (available for 30 days)

@spraza
spraza merged commit 2963ee8 into apple:release-7.4 Aug 20, 2026
1 check passed
spraza added a commit that referenced this pull request Sep 17, 2026
* Fix stale peers for client facing roles (storage server, commit proxy, grv proxy) (#13912)

Client processes can keep stale RequestStream references to dead
storage-server/proxy peers (via DatabaseContext::locationCache and
MonitorLeader::shrinkProxyList's sampled subset), causing connection-timeout
churn. Adds opt-in draining of dead-peer connections: a per-DatabaseContext
peer evictor driven by a persistent per-address connect-failed counter, a
shrinkProxyList cache clear below the connection cap, eager proxy rebuild on
clientInfo change, and an InterfaceTracker observability layer (all gated by
knobs, default off in production). invalidateCacheByAddress(es) processes
ranges in chunks and yields between chunks to avoid hogging the event loop
on large caches. Includes StalePeerTest, a deterministic repro workload.

Ported from upstream/release-7.3 PR #13367 (51e1c42)
and PR #13643 (805c271).
Conflicts resolved in: tests/CMakeLists.txt, fdbclient/NativeAPI.actor.cpp,
fdbclient/include/fdbclient/CommitProxyInterface.h,
fdbclient/include/fdbclient/StorageServerInterface.h,
fdbrpc/include/fdbrpc/FlowTransport.h, fdbserver/SimulatedCluster.actor.cpp.

(cherry picked from commit 2963ee8)

* Enable stale peer fixes by default on main/8.0

Flip the three stale-peer client-facing mitigation knobs from off to on by
default now that they have had bake time on 7.3/7.4:
  - location_cache_peer_evictor_enabled
  - shrink_proxy_list_clear_cache_below_threshold
  - dbcontext_eager_proxy_update

The forward-port landed these off by default (opt-in). By the 8.0 cut they
will have had sufficient production bake time, so main should ship with them
on. The simulation randomization (coinflip under randomize && isSimulated) is
left unchanged, so simulation still exercises both on and off states; only the
production default changes. The stale_peer_observability tracing knob is
intentionally left off (it is a debug aid, not a mitigation, and carries
overhead).

* fix clang-format

* fix clang-tidy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants