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

Wait after restarting FTL before trying to check version #5613

Open
wants to merge 1 commit into
base: development-v6
Choose a base branch
from

Conversation

DL6ER
Copy link
Member

@DL6ER DL6ER commented Mar 25, 2024

What does this implement/fix?

Prevent errors like seen in #5608 (comment) when Pi-hole uses itself as nameserver:

 Please note that changing branches severely alters your Pi-hole subsystems
  Features that work on the master branch, may not on a development branch
  This feature is NOT supported unless a Pi-hole developer explicitly asks!
  Have you read and understood this? [y/N] y

  [✓] Branch fix/ede_neterr exists
  [i] Switching to branch: "fix/ede_neterr" from "fix/ede_neterr"
  [✓] Downloading and Installing FTL
  [✓] Restarting pihole-FTL service...
  [✓] Enabling pihole-FTL service to start on reboot...
fatal: unable to access 'https://github.com/pi-hole/pi-hole/': Could not resolve host: github.com
fatal: unable to access 'https://github.com/pi-hole/web/': Could not resolve host: github.com
fatal: unable to access 'https://github.com/pi-hole/FTL/': Could not resolve host: github.com

Related issue or feature (if applicable): N/A

Pull request in docs with documentation (if applicable): N/A


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.
  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)

Checklist:

  • The code change is tested and works locally.
  • I based my code and PRs against the repositories developmental branch.
  • I signed off all commits. Pi-hole enforces the DCO for all contributions
  • I signed all my commits. Pi-hole requires signatures to verify authorship
  • I have read the above and my PR is ready for review.

@DL6ER DL6ER added Bug: fixed Contains a bug resolution Pi-hole v6.0 labels Mar 25, 2024
@DL6ER DL6ER requested a review from a team March 25, 2024 04:55
@DL6ER DL6ER requested a review from a team May 12, 2024 07:32
Copy link
Member

@yubiuser yubiuser left a comment

Choose a reason for hiding this comment

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

I agree with rdwebdesign. We should be not have an infinite loop that depends on outside conditions (network availability). I think we should have a counter and exit the loop after e.g. 10 seconds and ask users to manually run the update command afterwards.

@PromoFaux
Copy link
Member

I am not sure where my mind was when I first responded to RD's comment. Reading over the code again, actually it probably is a fair shout that we timeout after x seconds (the user could always ctrl+c, but that is not overly friendly

@DL6ER
Copy link
Member Author

DL6ER commented May 12, 2024

The script is constantly adding . to the output to show it's still alive. Waiting "forever" seems fine to me as the updater has no way to finish properly when there in no way to contact GitHub.

The suggested alternative is erroring out with no option for the user to wait longer if 10 seconds isn't enough to restart FTL on their RPi Zero with 100,000 queries to import from the database. Sure, the timeout could be 60 seconds but my opinion is that waiting "forever" and constantly showing that the script is still alive is the proper way to do this

@yubiuser
Copy link
Member

I know we had this before, but maybe the answer changed in-between: do we have any signal that would signal FTL's readiness to accept DNS queries (e.g. a second pid file)?


This PR is not about FTL only. The cat might have unplugged the cable just at the right moment - FTL might be ready for a long time, but there would be no network connectivity.

@DL6ER
Copy link
Member Author

DL6ER commented May 12, 2024

We could dig pi.hole or whatever always resolves without being forwarded.

I hear you and you are right, it's about more than FTL alone. However, without connectivity, there is no (simple) way the updater can exit gracefully.

@yubiuser
Copy link
Member

dig pi.hole @localhost could work. But this tells us only that FTL is ready, but has no meaning for systems that don't use FTL for their host's DNS resolution.

FTLinstall "${binary}"
restart_service pihole-FTL
enable_service pihole-FTL
str="Restarting FTL..."
echo -ne " ${INFO} ${str}"
Copy link
Member

Choose a reason for hiding this comment

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

Sure, the timeout could be 60 seconds but my opinion is that waiting "forever" and constantly showing that the script is still alive is the proper way to do this

Should we add here a text explaining FTL can take some time to restart and the process can loop forever without a connection? ("this can take several seconds")

Should we add "Press CTRL+C to exit"?
Or something like a simplified version of this spinner?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug: fixed Contains a bug resolution Pi-hole v6.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants