Skip to content

Backport four bug fixes from main to release-7.4 (#12318, #12643, #12750, #12755) - #13871

Merged
spraza merged 4 commits into
apple:release-7.4from
spraza:port-7.4-audit-batch1
Aug 18, 2026
Merged

spraza merged 4 commits into
apple:release-7.4from
spraza:port-7.4-audit-batch1

Conversation

@spraza

@spraza spraza commented Aug 14, 2026 •

Copy link
Copy Markdown
Collaborator

Backports four already-merged main bug fixes to release-7.4, ahead of 7.4.7.

  1. Fix circular recursion in Snapshot.Option #12318, Fix circular recursion in Snapshot.Options() (Go binding)
  2. Fix a few file read cancellation bugs #12643, Fix a few file read cancellation bugs (partial: only the calculateFileChecksum() UAF hunk applies to release-7.4, see commit message and conflict notes)
  3. Fix a DD shutdown crash #12750, Fix a DD shutdown crash
  4. Track min popped version separately for system localities in TLog #12755, Track min popped version separately for system localities in TLog

Did not fully backport number 2 above, either because part of it was already there, or part of it had its logic changed. For the latter, I'll do more research and open a new PR if needed.

100K: 20260813-181902-praza-port-7.4-audit-batch1-1e1c9c9a89774015, 100000/100000 pass

@saintstack saintstack 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 (and to copilot review)

@foundationdb-ci

This comment has been minimized.

@foundationdb-ci

This comment has been minimized.

@foundationdb-ci

This comment has been minimized.

@foundationdb-ci

This comment has been minimized.

@foundationdb-ci

This comment has been minimized.

@foundationdb-ci

This comment has been minimized.

@spraza
spraza force-pushed the port-7.4-audit-batch1 branch from 750bd66 to e9e8dba Compare August 17, 2026 16:43
@foundationdb-ci

This comment has been minimized.

@foundationdb-ci

This comment has been minimized.

@foundationdb-ci

This comment has been minimized.

@foundationdb-ci

This comment has been minimized.

@foundationdb-ci

This comment has been minimized.

@foundationdb-ci

This comment has been minimized.

spraza added 4 commits August 18, 2026 10:37
Authored-by: Baptiste Merliot <42059119+BMerliot@users.noreply.github.com>

(cherry picked from commit fba84d9 on main)
To reproduce clang build at 7.3.69
seed: -f ./tests/restarting/from_7.3.0_until_7.4.0/SnapTestAttrition-1.toml -s 1392115560 -b on

Setup

- dataDistribution is running its main loop. The actors vector (non-state) holds all the sub-actors including DataDistributionTracker::run.
- trackerCancelled (state bool) is false.
- The tracker has finished trackInitialShards and is sitting inside the loop choose, waiting on multiple futures including loggingTrigger.
- loggingTrigger is state Future<Void>. It was initialized as Void() — an already-completed future. After the first firing, it gets reset to delay(...). So on the very first iteration
   of the loop, it fires immediately.

The trigger — an error in another actor

1. Some other actor in actors throws (e.g. movekeys_conflict from a DDTeamCollection actor). waitForAll(actors) propagates this error out of wait(waitForAll(actors)).
2. Execution enters the catch block at DataDistribution.actor.cpp:1114.
3. Line 1115: trackerCancelled = true.
4. Team collection References are cleared (lines 1129–1131). This destroys DDTeamCollection objects synchronously.
5. The error is not actor_cancelled, so we reach line 1142: wait(shards.clearAsync()). The actor suspends here. shards is a state KeyRangeMap<ShardTrackedData> — clearing a large map
is broken into async chunks to avoid starving the event loop.

The pending network response fires during the yield

6. The FDB simulator event loop picks up the next task: a WaitMetrics reply from a storage server arrives for one of the trackShardMetrics actors.
7. SAV<StorageMetrics>::finishSendAndDelPromiseRef() fires its callbacks synchronously in a chain:

    - TrackShardMetricsActor receives the WaitMetrics reply and updates its AsyncVar<Optional<ShardMetrics>> via set().
    - AsyncVar::set destroys the old onChange Promise<Void>, sends to the onChange listeners
    - The QuorumCallback inside changeSizes (or GetFirstSizeActor) fires, completing the quorum. changeSizes completes.
    - trackInitialShards resumes after wait(changeSizes(...)). It calls self->readyToStart.send(Void()), then hits wait(initialSize). If initialSize is already satisfied (all shards
  have reported), trackInitialShards returns.
    - DataDistributionTrackerImpl::run resumes at a_body1cont2 — i.e., after wait(trackInitialShards(...)).
8. Without any trackerCancelled check, run proceeds straight into the loop choose for the first time — a_body1cont2loopHead1 in the generated code.

The crash

9. The loop choose evaluates which futures are ready. loggingTrigger was initialized as Void() and has never been reset yet (this is the first entry into the loop). It is already
  complete.
10. The when(wait(loggingTrigger)) branch fires immediately and executes:
  TraceEvent("DDTrackerStats", self->distributorId)
      .detail("Shards", self->shards->size())   // <-- CRASH
11. self->shards is a raw KeyRangeMap<ShardTrackedData>* pointing at the state shards variable back in dataDistribution. That shards is in the middle of clearAsync() — its internal
  structure is partially destroyed/invalid.
12. Accessing shards->size() on a partially-cleared KeyRangeMap causes a segfault. Signal 11 (SIGSEGV).

(cherry picked from commit 3f15166 on main)
@spraza
spraza force-pushed the port-7.4-audit-batch1 branch from e9e8dba to 6e3c995 Compare August 18, 2026 17:37
@spraza
spraza marked this pull request as ready for review August 18, 2026 17:37
@foundationdb-ci

Copy link
Copy Markdown
Contributor

Result of foundationdb-pr-clang on Linux RHEL 9

  • Commit ID: 6e3c995
  • Duration 0:42:50
  • 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-clang-arm on Linux RHEL 9

  • Commit ID: 6e3c995
  • Duration 0:47:26
  • 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-macos on macOS 14.x

  • Commit ID: 6e3c995
  • Duration 0:53:59
  • 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-macos-m1 on macOS 14.x

  • Commit ID: 6e3c995
  • Duration 1:09:53
  • 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-cluster-tests on Linux RHEL 9

  • Commit ID: 6e3c995
  • Duration 1:34:20
  • 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

Copy link
Copy Markdown
Contributor

Result of foundationdb-pr on Linux RHEL 9

  • Commit ID: 6e3c995
  • Duration 0:49:28
  • 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 b7d6636 into apple:release-7.4 Aug 18, 2026
1 of 2 checks passed
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.

5 participants