The error message
ERROR: Unable to connect to servers to test latency.
rang a bell in my head.
I had referenced it in another post.
I found that the speedtest-cli program gives that message when it thinks too many attempts have been made to often to access the servers and it blocks the IP.
At that time I found a pull request in the speedtest-cli github that refers to this error and that many users believe that it is not due to too many attempts by themselves but that there is a bug in the code. It seems to occur for people more often when the access is being done at the half hour. It seemed to be getting triggered by home automation software running the speedtest for some reason and failing for the unable to connect to servers error.
https://github.com/sivel/speedtest-cli/pull/796
A user had supplied a pull request patch fix back in Feb 2023 but there has been no response from the github owner since then and there have been more response to the issue thread in github during 2024. It looks like the software is no longer being supported as the last commit was 4 years ago. The last response by the github owner was in Apr 2022 and that was just to close the pull request as not being done.
Some of the users reporting on the issue in github have tried the patch, which changes the software to get the server list via json and some of the home automation users have tested it and reported that it worked for them.
I will look at testing this out on my vm dev testbed but first need to confirm that those systems also have the same issue.
The tests so far have been run on my production system but I won’t modify code on that system.
After remembering that the issue seemed to be that the speedtest software when looking for servers has a problem when that is done at the half hour I modified my fcrontab from 12:30 to 12:15.
The speedtest check worked!!
So maybe a simple workaround is that you use 01:15 or 01:45 instead of 01:30 until I can test out the change to the speedtest python code and confirm if it works properly or not.
EDIT:
Added the 12:30 back in to the fcrontab and it failed again. So I think this confirms that the speedtest code for finding the servers to use has a bug in it that issues an error message for too many attempts if the attempt is done at the half hour. This looks like it is not in the speedtest.py code itself but in the php code that speedtest.net runs to get the server list.
This should probably happen also if manually done but that is more difficult to test as it depends on the time window that the speedtest software has a problem with.
EDIT2:
I manually ran the following command
speedtest-cli --no-upload --secure --csv
at precisely 14:30
and got the ERROR: Unable to connect to servers to test latency.
message.
Running the same command at 14:32 worked without issues.
I think this definitely confirms that speedtest has a problem with any requests at the half hour.
EDIT3:
Confirmed that the problem occurred at 15:00 so it occurs at every half hour.
I then retested running the command at 15:00:10 and still the error message. Same at 15:00:15 but at 15:00:30 the command worked. So the boundary of the problem is somewhere between 15 secs and 30 secs after the half hour period.