Repository navigation
Conversation
| if self._fetched_remote and speed_sort and region_list: | ||
| info('Sorting your selected mirror list based on the speed between you and the individual mirrors (this might take a while)') | ||
| max_workers = min(16, len(region_list)) | ||
| with ThreadPoolExecutor(max_workers=max_workers) as executor: |
There was a problem hiding this comment.
Would this not cause an unfair speed measurement considering max_workers compete for the available speed?
There was a problem hiding this comment.
I don't think we want concurrency at all for this. Sequentially even with 100s of mirrors in a region, it should breeze through them (10-20 seconds), if it's getting stuck somewhere it's likely due to how we currently handle flaky/dead mirrors, not a need for workers.
If anything its additional packages that should be threaded (#4083)
The title of this PR also doesn't make sense, sorting happens after the TUI. I sense this might be automated with the escapes leaking in the PR xd
…rchlinux#4858) Mirror ranking previously hung or took several minutes when encountering unresponsive, slow, or flaky mirrors: - DownloadTimer was entered after urlopen, leaving DNS resolution, connection establishment, and TLS handshakes unguarded by SIGALRM. - Failed or resetting connections retried up to 3 times per mirror. - Socket timeouts and download timers were unnecessarily generous (5s) for downloading a ~131 KB core.db file. Changes: - Enter DownloadTimer before urlopen so the entire connection and download operation is bounded by SIGALRM. - Lower probe timeout to 3 seconds, which is ample for viable mirrors transferring core.db while failing fast on slow/dead mirrors. - Fail fast and skip unreachable or flaky mirrors immediately with speed 0 without retrying during speed ranking. - Guard against ZeroDivisionError when timer.time == 0. - Handle AttributeError/ValueError in DownloadTimer when signal/alarm is unavailable. - Add unit tests for speed ranking order, error/timeout handling, and timer behavior. Fixes archlinux#4858
76ee773 to
350c6d1
Compare
|
Thanks for the feedback @Torxed and @h8d13! I've updated the PR to pivot away from concurrency and address the root cause of the hang:
|
|
Scope looks much better IMO |
PR Description:
During mirror ranking, selecting regions with large numbers of mirrors (such as France or Germany) previously caused
archinstallto hang or take several minutes when encountering unresponsive, slow, or flaky mirrors.Root Cause:
DownloadTimerwas entered afterurllib.request.urlopen(). Consequently,SIGALRMwas not active during DNS resolution, TCP connection establishment, or TLS handshakes, relying solely on socket timeouts which could block for 5–10+ seconds per address.ConnectionResetErrororIncompleteReadretried up to 3 times (_speedtest_retries = 3). For dead or flaky mirrors, this multiplied the delay significantly.core.dbfile had a 5-second socket timeout and 5-second timer. Healthy mirrors download this in <1.5s, while failing mirrors blocked for 5+ seconds each.Changes:
urlopeninsideDownloadTimer:DownloadTimeris entered beforeurllib.request.urlopen, ensuring that DNS resolution, TCP connection, TLS handshake, headers, and body read are all strictly bounded bySIGALRM.speed = 0so the installer moves on to the next mirror without delay.ZeroDivisionErrorwhentimer.time == 0.DownloadTimer: HandledAttributeErrorandValueErrorsafely when signal handling is unsupported.tests/test_mirrorlist.pyfor mirror speed ranking order, error/timeout handling, and timer behavior.Tests and Checks
tests/test_mirrorlist.pypassing (6/6 passed).ruff checkandruff format(0 errors).