Skip to content

Conversation

@lycoris106
Copy link

@lycoris106 lycoris106 commented Dec 4, 2025

Description

This PR fixes some flaky tests found with NonDex, which explores non-determinism in tests. These tests can fail under different JVMs, hash seeds, etc.

The flaky tests:

  • MultipartObjectAssemblerTest.addParts_withChecksum_allSuccessful_commit
  • MultipartObjectAssemblerTest.addParts_allSuccessful_withRetryConfiguration_commit
  • MultipartObjectAssemblerTest.addParts_allSuccessful_commit
  • MultipartTransferManagerTest.awaitCompletion

Root Cause

MultipartManifestImpl stores parts in a HashMap, and listing methods such as listCompletedParts, listFailedParts iterate over parts. Since HashMap does not preserve any iteration order, the returned part lists are nondeterministic. However, multipart upload semantics process parts in ascending part number order. This mismatch caused flaky behavior when tests implicitly depend on ordered output.

Fix

Following the semantics of part numbers, we can use TreeMap to preserve the parts' order using the keys, with negligible overhead introduced.

Failure Reproduction

  • Java version:
    openjdk 21.0.8 2025-07-15
    OpenJDK Runtime Environment (build 21.0.8+9-Ubuntu-0ubuntu124.04.1)
    OpenJDK 64-Bit Server VM (build 21.0.8+9-Ubuntu-0ubuntu124.04.1, mixed mode, sharing)
    
  • OS version:
    Ubuntu 24.04.3 LTS

Build with the main branch and run tests with NonDex to observe the failure, for example:

mvn edu.illinois:nondex-maven-plugin:2.2.1:nondex -pl bmc-objectstorage/bmc-objectstorage-extensions \
    -Dtest=MultipartObjectAssemblerTest -DnondexRuns=10 \
    -Djacoco.skip -Drat.skip -Dpmd.skip -Denforcer.skip

Notes

Signed-off-by: Chih-Fu Lai <lycoris1062@gmail.com>
@oracle-contributor-agreement
Copy link

Thank you for your pull request and welcome to our community! To contribute, please sign the Oracle Contributor Agreement (OCA).
The following contributors of this PR have not signed the OCA:

To sign the OCA, please create an Oracle account and sign the OCA in Oracle's Contributor Agreement Application.

When signing the OCA, please provide your GitHub username. After signing the OCA and getting an OCA approval from Oracle, this PR will be automatically updated.

If you are an Oracle employee, please make sure that you are a member of the main Oracle GitHub organization, and your membership in this organization is public.

@oracle-contributor-agreement oracle-contributor-agreement bot added the OCA Required At least one contributor does not have an approved Oracle Contributor Agreement. label Dec 4, 2025
@oracle-contributor-agreement
Copy link

Thank you for signing the OCA.

@oracle-contributor-agreement oracle-contributor-agreement bot added OCA Verified All contributors have signed the Oracle Contributor Agreement. and removed OCA Required At least one contributor does not have an approved Oracle Contributor Agreement. labels Dec 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

OCA Verified All contributors have signed the Oracle Contributor Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant