Skip to content
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

fix(reaper): refactor to allow retries and fix races #2728

Merged
merged 1 commit into from
Oct 18, 2024

Commits on Oct 18, 2024

  1. fix(reaper): refactor to allow retries and fix races

    Refactor how the reaper is created to allow for proper retries of
    temporary errors such as container not found issues during startup or
    shutdown races.
    
    This eliminates the use of sync.Once which wasn't solving the problem at
    hand and replaces it with a singleton spawner with locked access.
    
    Wrap reaper errors so we can determine the cause of failures more
    easily.
    
    Fix race condition in port wait when loading from container by always
    waiting for the port first.
    
    Remove unnecessary use of buffering and invalid retry logic in reaper
    connection handling which could never recover correctly from a partial
    read.
    
    Move the reaper creation just before connections are established in
    compose to ensure its still running when the Connect calls are made.
    
    Previously the reaper was requested in NewDockerComposeWith which
    means it could have already shutdown before connections are made
    during the later sections of Up if the startup took over 1 minute.
    
    This was causing consistent failures for:
    TestDockerComposeAPIWithWaitLogStrategy
    
    Ensure that resource labels are correct so that resources aren't reaped
    when the reaper is disabled by excluding session id when reaper is
    disabled.
    
    Error when creating a reaper when the config says it's disabled so that
    we avoid hard to debug issues because a reaper is running when it
    shouldn't be.
    
    Set org.testcontainers.reap label for containers which should be reaped
    by the reaper, to prevent containers which disable the reaper from being
    incorrectly reaped.
    stevenh committed Oct 18, 2024
    Configuration menu
    Copy the full SHA
    8bfe616 View commit details
    Browse the repository at this point in the history