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

Pihole api unresponsive after consecutive requests #2301

Open
lovelaze opened this issue Feb 26, 2025 · 4 comments
Open

Pihole api unresponsive after consecutive requests #2301

lovelaze opened this issue Feb 26, 2025 · 4 comments

Comments

@lovelaze
Copy link

lovelaze commented Feb 26, 2025

Versions

Core version is v6.0.4 (Latest: v6.0.4)
Web version is v6.0.1 (Latest: v6.0.1)
FTL version is v6.0.2 (Latest: v6.0.2)

Platform

  • OS and version: Debian 12
  • Platform: Docker

Expected behavior

The pihole api to not become unresponsive and refuse connections temporarily.

Actual behavior / bug

It seems like the pihole api becomes unresponsive briefly after sending the following request: PATCH /api/config.

A consecutive request to POST /api/action/gravity after a receving a http 200 from PATCH /api/config fails:

go http client error: http://192.168.0.148/api/action/gravity: Post \"http://192.168.0.148/api/action/gravity\": dial tcp 192.168.0.148:80: connect: connection refused"

This occurs intermittently, it's not unresponsive every time. Is this expected behavior?

Steps to reproduce

Steps to reproduce the behavior:

  1. PATCH /api/config
  2. POST /api/action/gravity
  3. See error

Debug Token

@yubiuser
Copy link
Member

Is this expected behavior?

Likely. There are many configuration changes, that require a restart before they have any effect. FTL is smart enough to know which changes require a restart and will automatically restart itself. During the restart, the API won't respond.

When you go to Settings > All Settings you see a small restart symbol for all options that require/trigger a restart

@yubiuser yubiuser transferred this issue from pi-hole/pi-hole Feb 27, 2025
@lovelaze
Copy link
Author

Likely. There are many configuration changes, that require a restart before they have any effect. FTL is smart enough to know which changes require a restart and will automatically restart itself. During the restart, the API won't respond.

Thanks, that makes sense. Do you have any recommendation of how to make consecutive api calls? I would like to avoid sleeping before proceeding with the next call, is there any preferred endpoint to call to "healthcheck" the api?

@yubiuser
Copy link
Member

yubiuser commented Mar 1, 2025

I don't think we have any specific health check endpoint. I myself would use /auth because it will also tell you if re-authentication is required.

@DL6ER
Copy link
Member

DL6ER commented Mar 1, 2025

I concur on using /auth for checking if the API is reachable. Alternatively, you can sleep only if changing an endpoint which is known to need a full restart. Use the GET parameter ?detailed=true when querying /config to get a boolean next to each of the config options telling you if a full restart is required or not. If not, there will be no downtime at all as FTL will be able to change the setting immediately at runtime.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants