Skip to content

Fix infinite loop in wait_for_health() when container has no HEALTHCHECK configured#513

Open
mohityadav8 wants to merge 1 commit into
adeyosemanputra:v3.0.0-prefrom
mohityadav8:fix-wait-for-health-none
Open

Fix infinite loop in wait_for_health() when container has no HEALTHCHECK configured#513
mohityadav8 wants to merge 1 commit into
adeyosemanputra:v3.0.0-prefrom
mohityadav8:fix-wait-for-health-none

Conversation

@mohityadav8

@mohityadav8 mohityadav8 commented Apr 4, 2026

Copy link
Copy Markdown
Contributor

Close #512

Overview

Fixes an issue where the wait_for_health() function could loop until timeout when a container has no HEALTHCHECK configured.

Problem

When a container does not define a HEALTHCHECK in its Dockerfile, Docker returns None for the health status.
The existing implementation did not handle this case, causing the loop to continue until the timeout was reached. This results in unnecessary waiting and incorrect behavior.

Solution

Added explicit handling for the None health status.
If health_status is None, the function immediately returns True, since the container has no healthcheck configured and waiting is unnecessary.

if health_status is None:
    return True:

@caffeine-rohit

Copy link
Copy Markdown
Contributor

The updated wait_for_health() function looks good 👍
We can also consider adding a test case for this in a follow up PR in future

Also, a small note: the Close #512 doesn’t seem to be linking correctly. You may want to move it outside the code block so it properly links to the issue. Thanks !

@mohityadav8

Copy link
Copy Markdown
Contributor Author

done

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.

2 participants