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

Treat unhealthy docker container as down #4372

Draft
wants to merge 5 commits into
base: 1.23.X
Choose a base branch
from

Conversation

vfosnar
Copy link

@vfosnar vfosnar commented Jan 15, 2024

  • I have read and understand the pull request rules.

Description

Fixes #4369

Type of change

Please delete any options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
    or
  • Breaking change (a fix or feature that would cause existing functionality to not work as expected)

Checklist

  • My code follows the style guidelines of this project
  • I ran ESLint and other linters for modified files
  • I have performed a self-review of my own code and tested it
  • I have commented my code, particularly in hard-to-understand areas (including JSDoc for methods)
  • My changes generates no new warnings
  • My code needed automated testing. I have added them (this is optional task)

@CommanderStorm

This comment was marked as resolved.

@vfosnar

This comment was marked as resolved.

@louislam louislam added this to the 1.23.12 milestone Jan 15, 2024
@nougad
Copy link

nougad commented Jan 15, 2024

Thank you @vfosnar for merging my commit. The change looks good to me. I'm surprised I completely missed that bug when I made my change. 🙈

My only suggestion would be to make DOWN the default (in the else branch):

That way any unknown input would result in DOWN instead of showing it as UP. But that's just a suggestion and not a blocker.

@chakflying
Copy link
Collaborator

We may also need to increment retries in case it's stuck in starting.

@vfosnar
Copy link
Author

vfosnar commented Jan 15, 2024

This should (don't count on that) be okay because if you have a healthcheck defined the daemon will respond with "unhealthy"

@chakflying
Copy link
Collaborator

I haven't tested this, I'm just wondering if you set a container to automatically restart, but it keeps failing, would it be shown as always "starting"

@vfosnar
Copy link
Author

vfosnar commented Jan 16, 2024

nvm you're right, it will get stuck even with a healthcheck

@vfosnar
Copy link
Author

vfosnar commented Jan 16, 2024

But I'm not sure if simply incrementing retries every time is the best way to handle this. We should respect the start period in which we won't increment them. No idea how to get data on that from the daemon tho.

I propose we get this pr merged and start a seperate issue.

@vfosnar
Copy link
Author

vfosnar commented Jan 16, 2024

or nah, I will just add the counting, better false positive than false negative

@CommanderStorm
Copy link
Collaborator

Should be possible via listing containers with filters Screenshot_20240116_110202_Chrome.jpg

@vfosnar
Copy link
Author

vfosnar commented Jan 17, 2024

I think the best way to handle this is to treat the monitor as DOWN if the container is in the "starting" state, as it basically is down for the end user.

This PR is ready to be reviewed.

Copy link
Collaborator

@CommanderStorm CommanderStorm left a comment

Choose a reason for hiding this comment

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

I have not tested the changes, but they seem way cleaner than the code before. 👍🏻

Could you rebase the changes onto the 1.23.X-branch instead?
This would reduce our effort involved in making this part of v1.23.12

@CommanderStorm CommanderStorm changed the title fix #4369 - treat unhealthy docker container as down Treat unhealthy docker container as down Jan 17, 2024
@CommanderStorm CommanderStorm added the area:monitor Everything related to monitors label Jan 17, 2024
@vfosnar

This comment was marked as resolved.

vfosnar

This comment was marked as off-topic.

@louislam

This comment was marked as resolved.

@louislam louislam changed the base branch from master to 1.23.X January 19, 2024 19:39
@louislam
Copy link
Owner

Making starting as DOWN is questionable.

I take Uptime Kuma's Docker image as an example:

HEALTHCHECK --interval=60s --timeout=30s --start-period=180s --retries=5 CMD extra/healthcheck

I set the starting period to 180s to make sure the server is fully started, in order to avoid "bootloop".

@louislam louislam added the question Further information is requested label Jan 19, 2024
@vfosnar
Copy link
Author

vfosnar commented Jan 19, 2024

Yeah but even if it's starting it is not responding to user's request and that's in my opinion something we should care and notify about

@louislam louislam removed this from the 1.23.12 milestone Jan 23, 2024
@louislam
Copy link
Owner

As it is changing the behaviour of this monitor type, I think it won't be merged into 1.23.X.

And I think it needs an alternative method to deal the issue. Making starting as DOWN is not necessarily correct in my cases, because in the running state, the service could be ready or not ready.

Maybe Uptime Kuma should also add something like --start-period to avoid the issue.

@CommanderStorm CommanderStorm marked this pull request as draft February 15, 2024 01:09
@CommanderStorm CommanderStorm added the pr:please address review comments this PR needs a bit more work to be mergable label May 19, 2024
@up2-date
Copy link

up2-date commented Nov 5, 2024

The problem still exists in current versions (even in the 2.0 beta). Is there a plan to fix this problem?

@rmatte
Copy link

rmatte commented Dec 2, 2024

Still a problem in the current version. Saw this today and missed a major issue for longer than I should have because of it (only eventually noticed because it was my DNS service that was down, but would have been useful to know right away).

391708163-6c07c390-fab4-47b4-8861-bd72cc0f6751

@charliik

This comment was marked as spam.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:monitor Everything related to monitors pr:please address review comments this PR needs a bit more work to be mergable question Further information is requested
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Kuma reports unhealthy docker containers as PENDING, not DOWN
8 participants