Skip to content

Harden parseErrorCodeFromS3 to never throw on non-XML responses#12986

Merged
saintstack merged 1 commit into
apple:mainfrom
saintstack:parseErrorCodeFromS3
Apr 15, 2026
Merged

Harden parseErrorCodeFromS3 to never throw on non-XML responses#12986
saintstack merged 1 commit into
apple:mainfrom
saintstack:parseErrorCodeFromS3

Conversation

@saintstack

@saintstack saintstack commented Apr 14, 2026

Copy link
Copy Markdown
Contributor

Return "" instead of throwing on parse failures since many HTTP error responses (502/503 HTML pages, empty bodies) are not XML. Remove unused backup_parse_s3_response_failure error code. Fix const-ref parameter, constexpr badRequestCode, and add unit tests.

I ran the ctests against s3

      Start  2: s3client_test
 2/56 Test  #2: s3client_test .....................................   Passed   15.39 sec
      Start  3: bulkload_test
 3/56 Test  #3: bulkload_test .....................................   Passed  153.42 sec


....

      Start 12: s3_backup_tests
12/56 Test #12: s3_backup_tests ...................................   Passed   92.57 sec
      Start 13: s3_backup_bulkdump_bulkload_tests
13/56 Test #13: s3_backup_bulkdump_bulkload_tests .................   Passed  244.74 sec

Return "" instead of throwing on parse failures since many HTTP error
responses (502/503 HTML pages, empty bodies) are not XML. Remove unused
backup_parse_s3_response_failure error code. Fix const-ref parameter,
constexpr badRequestCode, and add unit tests.

Copilot AI 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.

Pull request overview

Hardens S3 error-code extraction so non-XML HTTP error bodies (e.g., 502/503 HTML pages or empty responses) do not raise errors, and adds regression tests to ensure parsing remains best-effort.

Changes:

  • Update parseErrorCodeFromS3 to return "" on parse failures instead of throwing, and add diagnostic tracing for non-XML parse exceptions.
  • Remove the now-unused backup_parse_s3_response_failure error code.
  • Minor cleanup (constexpr for badRequestCode) and add unit tests covering valid/invalid XML, empty, HTML, and garbage responses.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
flow/include/flow/error_definitions.h Removes unused backup/restore error code tied to the old throwing behavior.
fdbclient/S3BlobStore.cpp Makes S3 error parsing non-throwing, improves const-correctness, and adds unit tests for common non-XML failure modes.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@gxglass gxglass left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think this is a relatively contained PR and a good candidate for immediate backporting

@foundationdb-ci

Copy link
Copy Markdown
Contributor

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

  • Commit ID: 84cdb05
  • Duration 0:23:48
  • 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-m1 on macOS Ventura 13.x

  • Commit ID: 84cdb05
  • Duration 0:34:58
  • 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 CentOS 7

  • Commit ID: 84cdb05
  • Duration 0:43:24
  • 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 Ventura 13.x

  • Commit ID: 84cdb05
  • Duration 0:47:33
  • 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 on Linux RHEL 9

  • Commit ID: 84cdb05
  • Duration 0:55:29
  • Result: ❌ FAILED
  • Error: Error while executing command: if python3 -m joshua.joshua list --stopped | grep ${ENSEMBLE_ID} | grep -q 'pass=10[0-9][0-9][0-9]'; then echo PASS; else echo FAIL && exit 1; fi. Reason: exit status 1
  • 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: 84cdb05
  • Duration 0:59:58
  • Result: ❌ FAILED
  • Error: Error while executing command: if python3 -m joshua.joshua list --stopped | grep ${ENSEMBLE_ID} | grep -q 'pass=10[0-9][0-9][0-9]'; then echo PASS; else echo FAIL && exit 1; fi. Reason: exit status 1
  • Build Log terminal output (available for 30 days)
  • Build Workspace zip file of the working directory (available for 30 days)

@saintstack

Copy link
Copy Markdown
Contributor Author

Failures are tests/slow/GcGenerations.toml, tests/restarting/from_7.3.0/ConfigureTestRestart-1.toml, tests/restarting/from_7.3.0/ConfigureTestRestart-2.toml, tests/fast/PrivateEndpoints.toml. main is a bit dirty. These seem unrelated....

@saintstack saintstack closed this Apr 14, 2026
@saintstack saintstack reopened this Apr 14, 2026
@foundationdb-ci

Copy link
Copy Markdown
Contributor

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

  • Commit ID: 84cdb05
  • Duration 0:29:56
  • 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: 84cdb05
  • Duration 0:43:20
  • Result: ❌ FAILED
  • Error: Error while executing command: ninja -v -C build_output -j ${NPROC} all packages strip_targets. Reason: exit status 1
  • 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-clang-arm on Linux CentOS 7

  • Commit ID: 84cdb05
  • Duration 0:44:40
  • 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 Ventura 13.x

  • Commit ID: 84cdb05
  • Duration 0:46: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

Copy link
Copy Markdown
Contributor

Result of foundationdb-pr-clang on Linux RHEL 9

  • Commit ID: 84cdb05
  • Duration 1:11:22
  • 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: 84cdb05
  • Duration 1:38:51
  • Result: ❌ FAILED
  • Error: Error while executing command: if python3 -m joshua.joshua list --stopped | grep ${ENSEMBLE_ID} | grep -q 'pass=10[0-9][0-9][0-9]'; then echo PASS; else echo FAIL && exit 1; fi. Reason: exit status 1
  • Build Log terminal output (available for 30 days)
  • Build Workspace zip file of the working directory (available for 30 days)

@saintstack

Copy link
Copy Markdown
Contributor Author

tests/fast/SwizzledRollbackSideband.toml failed. Unrelated.

@saintstack saintstack closed this Apr 14, 2026
@saintstack saintstack reopened this Apr 14, 2026
@foundationdb-ci

Copy link
Copy Markdown
Contributor

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

  • Commit ID: 84cdb05
  • Duration 3:00:17
  • Result: ❌ FAILED
  • Error: Error while executing command: TEST_USERNAME=fdb-pr-${CODEBUILD_BUILD_NUMBER} make -C e2e foundationdb-pr-tests. Reason: exit status 2
  • 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-clang-ide on Linux RHEL 9

  • Commit ID: 84cdb05
  • Duration 0:28:33
  • 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 CentOS 7

  • Commit ID: 84cdb05
  • Duration 0:43:11
  • 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: 84cdb05
  • Duration 1:15:46
  • 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 on Linux RHEL 9

  • Commit ID: 84cdb05
  • Duration 1:26:07
  • Result: ❌ FAILED
  • Error: Error while executing command: if python3 -m joshua.joshua list --stopped | grep ${ENSEMBLE_ID} | grep -q 'pass=10[0-9][0-9][0-9]'; then echo PASS; else echo FAIL && exit 1; fi. Reason: exit status 1
  • Build Log terminal output (available for 30 days)
  • Build Workspace zip file of the working directory (available for 30 days)

@saintstack

Copy link
Copy Markdown
Contributor Author

tests/restarting/from_7.3.0/ConfigureStorageMigrationTestRestart-1.toml Unrelated

@saintstack saintstack closed this Apr 14, 2026
@saintstack saintstack reopened this Apr 14, 2026
@foundationdb-ci

Copy link
Copy Markdown
Contributor

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

  • Commit ID: 84cdb05
  • Duration 0:23:56
  • 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-m1 on macOS Ventura 13.x

  • Commit ID: 84cdb05
  • Duration 0:33:35
  • 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 CentOS 7

  • Commit ID: 84cdb05
  • Duration 0:43:34
  • 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 Ventura 13.x

  • Commit ID: 84cdb05
  • Duration 0:47:11
  • 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 on Linux RHEL 9

  • Commit ID: 84cdb05
  • Duration 0:54:22
  • Result: ❌ FAILED
  • Error: Error while executing command: if python3 -m joshua.joshua list --stopped | grep ${ENSEMBLE_ID} | grep -q 'pass=10[0-9][0-9][0-9]'; then echo PASS; else echo FAIL && exit 1; fi. Reason: exit status 1
  • 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: 84cdb05
  • Duration 0:57:10
  • Result: ❌ FAILED
  • Error: Error while executing command: if python3 -m joshua.joshua list --stopped | grep ${ENSEMBLE_ID} | grep -q 'pass=10[0-9][0-9][0-9]'; then echo PASS; else echo FAIL && exit 1; fi. Reason: exit status 1
  • 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: 84cdb05
  • Duration 3:00:11
  • Result: ❌ FAILED
  • Error: Error while executing command: TEST_USERNAME=fdb-pr-${CODEBUILD_BUILD_NUMBER} make -C e2e foundationdb-pr-tests. Reason: exit status 2
  • 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)

@saintstack saintstack closed this Apr 14, 2026
@saintstack saintstack reopened this Apr 14, 2026
@foundationdb-ci

Copy link
Copy Markdown
Contributor

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

  • Commit ID: 84cdb05
  • Duration 3:00:16
  • Result: ❌ FAILED
  • Error: Error while executing command: TEST_USERNAME=fdb-pr-${CODEBUILD_BUILD_NUMBER} make -C e2e foundationdb-pr-tests. Reason: exit status 2
  • 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-clang-ide on Linux RHEL 9

  • Commit ID: 84cdb05
  • Duration 0:31:40
  • 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-m1 on macOS Ventura 13.x

  • Commit ID: 84cdb05
  • Duration 0:33:58
  • 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 CentOS 7

  • Commit ID: 84cdb05
  • Duration 0:42:48
  • 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: 84cdb05
  • Duration 1:07:17
  • 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 on Linux RHEL 9

  • Commit ID: 84cdb05
  • Duration 1:15:48
  • 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)

@saintstack saintstack merged commit 7388f54 into apple:main Apr 15, 2026
10 of 11 checks passed
@foundationdb-ci

Copy link
Copy Markdown
Contributor

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

  • Commit ID: 84cdb05
  • Duration 3:00:14
  • Result: ❌ FAILED
  • Error: Build has timed out.
  • 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)

saintstack pushed a commit to saintstack/foundationdb that referenced this pull request Apr 15, 2026
…e#12986)

Return "" instead of throwing on parse failures since many HTTP error
responses (502/503 HTML pages, empty bodies) are not XML. Remove unused
backup_parse_s3_response_failure error code. Fix const-ref parameter
and add unit tests.

(cherry picked from commit 7388f54)
saintstack pushed a commit to saintstack/foundationdb that referenced this pull request Apr 15, 2026
…e#12986)

Add parseErrorCodeFromS3 function that safely extracts S3 error codes
from XML responses, returning "" instead of throwing on parse failures
since many HTTP error responses (502/503 HTML pages, empty bodies) are
not XML. Wire it into doRequest_impl error handling to log S3ErrorCode
and detect bad requests. Add unit tests.

(cherry picked from commit 7388f54)
saintstack pushed a commit to saintstack/foundationdb that referenced this pull request Apr 15, 2026
…e#12986)

Add parseErrorCodeFromS3 function that safely extracts S3 error codes
from XML responses, returning "" instead of throwing on parse failures
since many HTTP error responses (502/503 HTML pages, empty bodies) are
not XML. Wire it into doRequest_impl error handling to log S3ErrorCode
and detect bad requests. Add unit tests.

(cherry picked from commit 7388f54)
spraza pushed a commit that referenced this pull request Apr 15, 2026
…12997)

* Harden parseErrorCodeFromS3 to never throw on non-XML responses (#12986)

Add parseErrorCodeFromS3 function that safely extracts S3 error codes
from XML responses, returning "" instead of throwing on parse failures
since many HTTP error responses (502/503 HTML pages, empty bodies) are
not XML. Wire it into doRequest_impl error handling to log S3ErrorCode
and detect bad requests. Add unit tests.

(cherry picked from commit 7388f54)

* Log all S3 4xx client errors, not just 400

Widen the S3 error logging from only HTTP 400 to all 4xx client errors
(403, 404, 409, etc). Remove unused badRequestCode variable. Rename
trace event from S3BlobStoreBadRequest to S3BlobStoreClientError.

* Fix trace

* Simplify S3BlobStore request error handling (merge PR #13001)

* Remove separate S3BlobStoreClientError event, use existing event

---------

Co-authored-by: michael stack <stack@duboce.com>
saintstack added a commit to saintstack/foundationdb that referenced this pull request Apr 18, 2026
…pple#12997)

* Harden parseErrorCodeFromS3 to never throw on non-XML responses (apple#12986)

Add parseErrorCodeFromS3 function that safely extracts S3 error codes
from XML responses, returning "" instead of throwing on parse failures
since many HTTP error responses (502/503 HTML pages, empty bodies) are
not XML. Wire it into doRequest_impl error handling to log S3ErrorCode
and detect bad requests. Add unit tests.

(cherry picked from commit 7388f54)

* Log all S3 4xx client errors, not just 400

Widen the S3 error logging from only HTTP 400 to all 4xx client errors
(403, 404, 409, etc). Remove unused badRequestCode variable. Rename
trace event from S3BlobStoreBadRequest to S3BlobStoreClientError.

* Fix trace

* Simplify S3BlobStore request error handling (merge PR apple#13001)

* Remove separate S3BlobStoreClientError event, use existing event

---------

Co-authored-by: michael stack <stack@duboce.com>
saintstack added a commit that referenced this pull request Apr 20, 2026
…) (#12996)

Return "" instead of throwing on parse failures since many HTTP error
responses (502/503 HTML pages, empty bodies) are not XML. Remove unused
backup_parse_s3_response_failure error code. Fix const-ref parameter
and add unit tests.

(cherry picked from commit 7388f54)
saintstack added a commit that referenced this pull request Apr 22, 2026
* Harden parseErrorCodeFromS3 to never throw on non-XML responses 7.3 (#12997) - 7.3

* Harden parseErrorCodeFromS3 to never throw on non-XML responses (#12986) - main

Add parseErrorCodeFromS3 function that safely extracts S3 error codes
from XML responses, returning "" instead of throwing on parse failures
since many HTTP error responses (502/503 HTML pages, empty bodies) are
not XML. Wire it into doRequest_impl error handling to log S3ErrorCode
and detect bad requests. Add unit tests.

(cherry picked from commit 7388f54)

* Log all S3 4xx client errors, not just 400

Widen the S3 error logging from only HTTP 400 to all 4xx client errors
(403, 404, 409, etc). Remove unused badRequestCode variable. Rename
trace event from S3BlobStoreBadRequest to S3BlobStoreClientError.

* Fix trace

* Simplify S3BlobStore request error handling (merge PR #13001)

* Remove separate S3BlobStoreClientError event, use existing event
neethuhaneesha pushed a commit to neethuhaneesha/foundationdb that referenced this pull request Jun 11, 2026
…pple#12997)

* Harden parseErrorCodeFromS3 to never throw on non-XML responses (apple#12986)

Add parseErrorCodeFromS3 function that safely extracts S3 error codes
from XML responses, returning "" instead of throwing on parse failures
since many HTTP error responses (502/503 HTML pages, empty bodies) are
not XML. Wire it into doRequest_impl error handling to log S3ErrorCode
and detect bad requests. Add unit tests.

(cherry picked from commit 7388f54)

* Log all S3 4xx client errors, not just 400

Widen the S3 error logging from only HTTP 400 to all 4xx client errors
(403, 404, 409, etc). Remove unused badRequestCode variable. Rename
trace event from S3BlobStoreBadRequest to S3BlobStoreClientError.

* Fix trace

* Simplify S3BlobStore request error handling (merge PR apple#13001)

* Remove separate S3BlobStoreClientError event, use existing event

---------

Co-authored-by: michael stack <stack@duboce.com>
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