foundationdb icon indicating copy to clipboard operation
foundationdb copied to clipboard

Fix dataMovementComplete promise dangling on error in checkFetchingState

Open Ronitsabhaya75 opened this issue 5 months ago • 19 comments

The problem:

While auditing MoveKeys.cpp, we noticed a FIXME around line 1240 in the checkFetchingState actor. When the data distributor is moving a shard and discovers that a destination server has vanished, it throws a move_to_removed_server error. However, it completely bypasses the dataMovementComplete promise. This leaves the relocation queue stuck waiting on a race condition for a future that never gets explicitly fulfilled or rejected, relying entirely on a fragile broken_promise error when the MoveKeysParams struct is finally destroyed.

The solution:

We updated checkFetchingState to explicitly send the move_to_removed_server error through the dataMovementComplete promise before throwing. To be absolutely safe, we also added a catch block for actor_cancelled to ensure the promise is rejected cleanly if the actor is killed. Finally, we wrapped the main moveKeys actor in a try-catch block as a top-level safety net, guaranteeing the promise is always resolved or rejected before the function exits. We also uncommented the CODE_PROBE for the removed server path so it gets properly tracked in simulation.

Testing done:

Manually traced the error propagation paths to ensure the relocation queue safely handles the rejected promise. Verified that the code compiles cleanly. Huge thanks to my co-author @Renish-patel (@renishpatel2482001) for helping out with the debugging and testing on this!

Ronitsabhaya75 avatar Jun 11 '26 00:06 Ronitsabhaya75

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

  • Commit ID: e6eac3ef580fe1ef6b17cab74c5b341e54df9697
  • Duration 0:20:58
  • Result: :white_check_mark: 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 avatar Jun 12 '26 05:06 foundationdb-ci

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

  • Commit ID: e6eac3ef580fe1ef6b17cab74c5b341e54df9697
  • Duration 0:32:10
  • Result: :white_check_mark: 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 avatar Jun 12 '26 05:06 foundationdb-ci

Result of foundationdb-pr on Linux RHEL 9

  • Commit ID: e6eac3ef580fe1ef6b17cab74c5b341e54df9697
  • Duration 0:43:07
  • Result: :x: FAILED
  • Error: Error while executing command: ctest -j ${NPROC} --no-compress-output -T test --output-on-failure. Reason: exit status 8
  • Build Log terminal output (available for 30 days)
  • Build Workspace zip file of the working directory (available for 30 days)

foundationdb-ci avatar Jun 12 '26 05:06 foundationdb-ci

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

  • Commit ID: e6eac3ef580fe1ef6b17cab74c5b341e54df9697
  • Duration 0:45:07
  • Result: :white_check_mark: 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 avatar Jun 12 '26 05:06 foundationdb-ci

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

  • Commit ID: e6eac3ef580fe1ef6b17cab74c5b341e54df9697
  • Duration 0:46:21
  • Result: :white_check_mark: 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 avatar Jun 12 '26 05:06 foundationdb-ci

Result of foundationdb-pr-clang on Linux RHEL 9

  • Commit ID: e6eac3ef580fe1ef6b17cab74c5b341e54df9697
  • Duration 0:49:05
  • Result: :white_check_mark: 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 avatar Jun 12 '26 05:06 foundationdb-ci

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

  • Commit ID: e6eac3ef580fe1ef6b17cab74c5b341e54df9697
  • Duration 1:02:27
  • Result: :white_check_mark: 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 avatar Jun 12 '26 05:06 foundationdb-ci

CI was failing because our initial fix sent all errors to the dataMovementComplete promise, even on paths where the caller wasn't awaiting it.

This triggered the actor framework's strict error checking, crashing the tests due to an unhandled promise error upon destruction.

which is fixed now.

@gxglass @saintstack would be able to have CI run again please

Ronitsabhaya75 avatar Jun 12 '26 15:06 Ronitsabhaya75

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

  • Commit ID: 0a854c1f6b2d8a102ffbe1dce24022cf6fd5f907
  • Duration 0:00:18
  • Result: :x: FAILED
  • Error: Unexpected EC2 error: InsufficientFreeAddressesInSubnet
  • Build Log terminal output (available for 30 days)
  • Build Workspace zip file of the working directory (available for 30 days)

foundationdb-ci avatar Jun 12 '26 16:06 foundationdb-ci

CI failure seem to be AWS infra flake nothing related to build

Ronitsabhaya75 avatar Jun 12 '26 16:06 Ronitsabhaya75

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

  • Commit ID: 0a854c1f6b2d8a102ffbe1dce24022cf6fd5f907
  • Duration 0:28:16
  • Result: :white_check_mark: 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 avatar Jun 12 '26 16:06 foundationdb-ci

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

  • Commit ID: 0a854c1f6b2d8a102ffbe1dce24022cf6fd5f907
  • Duration 0:31:51
  • Result: :white_check_mark: 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 avatar Jun 12 '26 16:06 foundationdb-ci

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

  • Commit ID: 0a854c1f6b2d8a102ffbe1dce24022cf6fd5f907
  • Duration 0:47:04
  • Result: :x: FAILED
  • Error: Error while executing command: ctest -j ${NPROC} --no-compress-output -T test --output-on-failure. Reason: exit status 8
  • Build Log terminal output (available for 30 days)
  • Build Workspace zip file of the working directory (available for 30 days)

foundationdb-ci avatar Jun 12 '26 17:06 foundationdb-ci

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

  • Commit ID: 0a854c1f6b2d8a102ffbe1dce24022cf6fd5f907
  • Duration 1:06:22
  • Result: :white_check_mark: 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 avatar Jun 12 '26 17:06 foundationdb-ci

54/55 Test  #4: bulkload_test .....................................   Passed  166.35 sec
55/55 Test #17: s3_backup_bulkdump_bulkload_tests .................   Passed  283.85 sec

98% tests passed, 1 tests failed out of 55

Total Test time (real) = 319.38 sec

The following tests FAILED:
	 44 - fdb_c_upgrade_to_future_version (Failed)
Errors while running CTest

which seems to be unrelated as change only modifies checkFetchingState in MoveKeys.cpp (data distributor).

Ronitsabhaya75 avatar Jun 12 '26 17:06 Ronitsabhaya75

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

  • Commit ID: 0a854c1f6b2d8a102ffbe1dce24022cf6fd5f907
  • Duration 1:19:51
  • Result: :white_check_mark: 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 avatar Jun 12 '26 17:06 foundationdb-ci

Result of foundationdb-pr-clang on Linux RHEL 9

  • Commit ID: 0a854c1f6b2d8a102ffbe1dce24022cf6fd5f907
  • Duration 1:40:21
  • Result: :white_check_mark: 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 avatar Jun 12 '26 17:06 foundationdb-ci

Result of foundationdb-pr on Linux RHEL 9

  • Commit ID: 0a854c1f6b2d8a102ffbe1dce24022cf6fd5f907
  • Duration 1:45:38
  • Result: :white_check_mark: 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 avatar Jun 12 '26 18:06 foundationdb-ci

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

  • Commit ID: 0a854c1f6b2d8a102ffbe1dce24022cf6fd5f907
  • Duration 0:45:08
  • Result: :white_check_mark: 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 avatar Jun 12 '26 18:06 foundationdb-ci