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

Fixing the FTL information on settings page after a FTL restart #2511

Merged
merged 2 commits into from Apr 15, 2023

Conversation

rdwebdesign
Copy link
Member

@rdwebdesign rdwebdesign commented Jan 23, 2023

What does this PR aim to accomplish?

This PR tries to fix a behavior affecting some installations (docker and bare metal) where the web interface button "Restart DNS resolver" causes an apparent error, while restarting FTL.

This topic from Discourse shows the problem on a bare metal install:
https://discourse.pi-hole.net/t/restart-dns-resolver-is-killing-new-ftl/60693

The real issue:
FTL is restarted, but in some cases the PHP page is reloaded before FTL is completely restarted.
The page uses the function pidofFTL() to read the PID, but the value is not found and "FTL is offline" message is shown.

A few milliseconds after that, FTL finishes the restart process, but in some cases the restart could take seconds to finish.

Screen capture showing the behavior:
restart_FTL_issue

How does this PR accomplish the above?

Adding a new message and a countdown to wait for FTL to restart.

Link documentation PRs if any are needed to support this PR

none


By submitting this pull request, I confirm the following:

  1. I have read and understood the contributors guide, as well as this entire template. I understand which branch to base my commits and Pull Requests against.
  2. I have commented my proposed changes within the code and I have tested my changes.
  3. I am willing to help maintain this change if there are issues with it later.
  4. It is compatible with the EUPL 1.2 license
  5. I have squashed any insignificant commits. (git rebase)
  6. I have checked that another pull request for this purpose does not exist.
  7. I have considered, and confirmed that this submission will be valuable to others.
  8. I accept that this submission may not be used, and the pull request closed at the will of the maintainer.
  9. I give this submission freely, and claim no ownership to its content.

  • I have read the above and my PR is ready for review. Check this box to confirm

@DL6ER
Copy link
Member

DL6ER commented Jan 23, 2023

FTL is restarted, but in some cases the PHP page is reloaded before FTL is completely restarted.

To me this sounds like the real fix would rather be delaying the reload. This is what others do, too, for instance my router: when I click on the restart button, it shows some 10 seconds countdown before it allows any further actions on the page. The countdown is ticking down so users don't get impatient thinking that maybe nothing is happening and something has frozen.

Mind that FTL may need longer than one second to restart on low end services with very many queries within 24 hours a it has to reload then after a restart.

@rdwebdesign
Copy link
Member Author

Well, this is actually delaying the reload, but only for a few milliseconds.

Reading your comment, I think we could simply add a third state.

The current PHP page shows 2 states:

  • FTL service is offline (in case no PID is found) or
  • the normal page with all values.

We could introduce a new state using a message "FTL is restarting...".

@rdwebdesign rdwebdesign requested a review from a team January 24, 2023 20:18
@rdwebdesign rdwebdesign force-pushed the fix/restartdns_reload branch 3 times, most recently from 92c0e75 to dfbf462 Compare February 14, 2023 02:39
@rdwebdesign rdwebdesign changed the title Add a parameter to pidofFTL() function to allow a delay when necessary Fixing the FTL information on settings page after a FTL restart Feb 14, 2023
@pralor-bot
Copy link

This pull request has been mentioned on Pi-hole Userspace. There might be relevant details there:

https://discourse.pi-hole.net/t/restart-dns-resolver-is-killing-new-ftl/60693/32

scripts/pi-hole/js/restartdns.js Outdated Show resolved Hide resolved
settings.php Outdated Show resolved Hide resolved
Signed-off-by: RD WebDesign <github@rdwebdesign.com.br>
Signed-off-by: RD WebDesign <github@rdwebdesign.com.br>
@pralor-bot
Copy link

This pull request has been mentioned on Pi-hole Userspace. There might be relevant details there:

https://discourse.pi-hole.net/t/the-ftl-service-is-offline-on-two-separate-raspi-using-docker-and-unbound/62095/6

@rdwebdesign
Copy link
Member Author

Branch was updated.

@rdwebdesign rdwebdesign requested a review from a team April 12, 2023 17:50
@rdwebdesign rdwebdesign merged commit efddf9c into devel Apr 15, 2023
15 checks passed
@rdwebdesign rdwebdesign deleted the fix/restartdns_reload branch April 15, 2023 16:06
@DL6ER DL6ER mentioned this pull request May 28, 2023
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.

None yet

4 participants