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

Limit curl execution time to 2s to find WAN IP #7755

Merged
merged 1 commit into from
Jan 27, 2025

Conversation

WiseLord
Copy link
Contributor

Option "--connect-timeout" used to determine external IP covers only connection phase. Curl may "hans" in a different phase and this makes login to the system impossible if MOTD "header" module enabled.

Using "--max-time" is more reliable and prevents hanging for hours.

Fixes issue #7753

Description

Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.

GitHub issue reference:
Jira reference number [AR-9999]

Documentation summary for feature / change

Please delete this section if entry to main documentation is not needed.

If documentation entry is predicted, please provide key elements for further implementation into main documentation and set label to "Needs Documentation". You are welcome to open a PR to documentation or you can leave following information for technical writer:

  • short description (copy / paste of PR title)
  • summary (description relevant for end users)
  • example of usage (how to see this in function)

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Please also note any relevant details for your test configuration.

  • Test A
  • Test B

Checklist:

Please delete options that are not relevant.

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings
  • Any dependent changes have been merged and published in downstream modules

Option "--connect-timeout" used to determine external IP covers only
connection phase. Curl may "hans" in a different phase and this makes
login to the system impossible if MOTD "header" module enabled.

Using "--max-time" is more reliable and prevents hanging for hours.

Fixes issue armbian#7753

Signed-off-by: Uladzimir Bely <[email protected]>
@WiseLord WiseLord requested a review from a team as a code owner January 27, 2025 08:38
@github-actions github-actions bot added size/small PR with less then 50 lines Needs review Seeking for review BSP Board Support Packages labels Jan 27, 2025
@WiseLord
Copy link
Contributor Author

Some timeout related options from man curl:

--connect-timeout <seconds>
    Maximum time in seconds that you allow curl's connection to take. This only limits the connection phase, so if curl connects within the given period it continues - if not it exits.
--happy-eyeballs-timeout-ms <ms>
    Happy  Eyeballs  is  an  algorithm that attempts to connect to both IPv4 and IPv6 addresses for dual-stack hosts, giving IPv6 a head-start of the specified number of milliseconds. 
--keepalive-time <seconds>
    Set the time a connection needs to remain idle before sending keepalive probes and the time between individual keepalive probes.
-m, --max-time <seconds>
    Set maximum time in seconds that you allow each transfer to take. Prevents your batch jobs from hanging for hours due to slow networks or links going down. This option accepts decimal values.

Copy link
Member

@igorpecovnik igorpecovnik left a comment

Choose a reason for hiding this comment

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

Thank you!

@igorpecovnik igorpecovnik added Ready to merge Reviewed, tested and ready for merge 02 Milestone: First quarter release and removed Needs review Seeking for review labels Jan 27, 2025
@igorpecovnik igorpecovnik merged commit 12d6d07 into armbian:main Jan 27, 2025
11 of 12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
02 Milestone: First quarter release BSP Board Support Packages Ready to merge Reviewed, tested and ready for merge size/small PR with less then 50 lines
Development

Successfully merging this pull request may close these issues.

2 participants