Skip to content

Fixed overflow bugs in backoff strategy #1668

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 49 commits into from

Conversation

Quanzzzz
Copy link
Contributor

Fixed issue #1453 based on the proposed fix code provided by OlegZhukov, set up ceils for baseDelay, maxBackoffTime and retriesAttempted to prevent potential overflow problems.

Description

Added three ceils for baseDelay, maxBackoffTime and retriesAttempted respectively. Restricted the exponentialDelayMillis from overflow via applying these ceils in calculation. Added unit tests for EqualJitterBackoffStrategy.java based on proposed test cases provided by OlegZhukov.

Motivation and Context

Before this modification, the exponentialDelay has a risk of overflow due to its type as Integer. Besides, baseDelay and maxBackoffTime are not checked if they will meet overflow problems while converting into Millis. So to fix these potential problems, we need to add some restrictions on these variables, as well as the calculation.

The open issue corresponding to this pull request is: #1453

Testing

Only one test class is added, and it only includes unit tests for EqualJitterBackoffStrategyTest.java. For FullJitterBackoffStrategy.java, there isn't appropriate test cases since the exponentialDelay calculated with Full Jitter Backoff Strategy is a totally random number, which isn't suitable for testing.

The unit tests added basically covering all possible cases include: normal situation of retries, retries with extreme large duration as baseDelay and maxBackoffTime respectively, retries with single nanosecond as baseDelay and maxBackoffTime respectively, valid retries Attempt times, invalid retries Attempt times and retries with negative duration.

Screenshots (if appropriate)

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)

Checklist

  • I have read the CONTRIBUTING document
  • Local run of mvn install succeeds
  • My code follows the code style of this project
  • My change requires a change to the Javadoc documentation
  • I have updated the Javadoc documentation accordingly
  • I have read the README document
  • I have added tests to cover my changes
  • All new and existing tests passed
  • A short description of the change has been added to the CHANGELOG
  • My change is to implement 1.11 parity feature and I have updated LaunchChangelog

License

  • I confirm that this pull request can be released under the Apache 2 license

Quanzzzz and others added 30 commits February 26, 2020 13:41
… the maximum policy document size for Image Builder resource-based policy APIs.
…t the guidance for associating a web ACL to a CloudFront distribution.
…ntering your GSTIN when creating AWS Snowball jobs in the Asia Pacific (Mumbai) region.
…for Lustre that are ideal for longer-term storage and workloads, and a new generation of scratch file systems that offer higher burst throughput for spiky workloads.
…d size of SecretString or SecretBinary from 10KB to 64KB in the CreateSecret, UpdateSecret, PutSecretValue and GetSecretValue APIs.
…Broker Log delivery to CloudWatch, S3, and Firehose.
zoewangg and others added 19 commits February 27, 2020 12:37
…ances CLI and SDK's so that if you do not specify a client token, a randomly generated token is used for the request to ensure idempotency.
…ports retained variant properties, e.g., instance count, variant weight. SageMaker ListTrials API filter by TrialComponentName. Make ExperimentConfig name length limits consistent with CreateExperiment, CreateTrial, and CreateTrialComponent APIs.
…s API operation a new response field called IntegrationTypes. The IntegrationTypes field lists the types of actions that a product performs relative to Security Hub such as send findings to Security Hub and receive findings from Security Hub.
…nt Redaction feature enables you to automatically redact sensitive personally identifiable information (PII) from transcription results. It replaces each instance of an identified PII utterance with a [PII] tag in the transcript.
…ags to accelerators and bringing your own IP address to AWS Global Accelerator (BYOIP).
… in Amazon Lightsail, and to create instance, database, and load balancer metric alarms that notify you based on the value of a metric relative to a threshold that you specify.
@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities (and Security Hotspot 2 Security Hotspots to review)
Code Smell A 1 Code Smell

No Coverage information No Coverage information
No Duplication information No Duplication information

@codecov-io
Copy link

codecov-io commented Feb 27, 2020

Codecov Report

❗ No coverage uploaded for pull request base (master@66b67ab). Click here to learn what that means.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##             master    #1668   +/-   ##
=========================================
  Coverage          ?   74.47%           
  Complexity        ?      902           
=========================================
  Files             ?      959           
  Lines             ?    30365           
  Branches          ?     2393           
=========================================
  Hits              ?    22613           
  Misses            ?     6617           
  Partials          ?     1135
Flag Coverage Δ Complexity Δ
#unittests 74.47% <ø> (?) 902 <ø> (?)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 66b67ab...e5edca4. Read the comment docs.

@Quanzzzz Quanzzzz closed this Feb 27, 2020
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.

6 participants