librespeed / speedtest-cli

Command line client for LibreSpeed
GNU Lesser General Public License v3.0
509 stars 63 forks source link

speed tests are timing out #31

Closed blnprasad closed 3 years ago

blnprasad commented 3 years ago

seems like speed test from cli failing. but same working from UI.

out/librespeed-cli-linux-amd64 Retrieving server list from https://librespeed.org/backend-servers/servers.php Selecting the fastest server based on ping Error checking for server status: Get "https://speedtest5.wegozyn.eu/backend/empty.php": dial tcp: lookup speedtest5.wegozyn.eu on 8.8.8.8:53: no such host Server Frankfurt am Main, Germany (speedtest5.wegozyn.eu) doesn't seem to be up, skipping Failed to ping target host: socket: permission denied Will try TCP ping Failed to ping target host: socket: permission denied Will try TCP ping Failed to ping target host: socket: permission denied Will try TCP ping Failed to ping target host: socket: permission denied Will try TCP ping Failed to ping target host: socket: permission denied Will try TCP ping Failed to ping target host: socket: permission denied Will try TCP ping Failed to ping target host: socket: permission denied Will try TCP ping Failed to ping target host: socket: permission denied Will try TCP ping Failed to ping target host: socket: permission denied Will try TCP ping Failed to ping target host: socket: permission denied Will try TCP ping Failed to ping target host: socket: permission denied Will try TCP ping Failed to ping target host: socket: permission denied Will try TCP ping Failed to ping target host: socket: permission denied Will try TCP ping Server New York, United States (1) (BuyVM) (ny1.backend.librespeed.nixnet.services) doesn't seem to be up, skipping Failed to ping target host: socket: permission denied Will try TCP ping Failed to ping target host: socket: permission denied Will try TCP ping Failed to ping target host: socket: permission denied Will try TCP ping Failed to ping target host: socket: permission denied Will try TCP ping Failed to ping target host: socket: permission denied Will try TCP ping Error checking for server status: Get "https://la1.us.backend.librespeed.org/empty.php": dial tcp 185.198.26.89:443: connect: no route to host Server Los Angeles, United States (2) (HostHatch) (la1.us.backend.librespeed.org) doesn't seem to be up, skipping Failed to ping target host: socket: permission denied Will try TCP ping Error checking for server status: Get "https://il1.us.backend.librespeed.org/empty.php": context deadline exceeded (Client.Timeout exceeded while awaiting headers) Server Chicago, United States (HostHatch) (il1.us.backend.librespeed.org) doesn't seem to be up, skipping Failed to ping target host: socket: permission denied Will try TCP ping --> hangs here

adolfintel commented 3 years ago

This may be related to some attacks that we've been getting on some of our servers.

blnprasad commented 3 years ago

I could still see its failing but always working with UI. when I debugged I found that due to some race condition, it stuck at collecting ping results job. with below changes I found it always working.

git diff speedtest/speedtest.go
diff --git a/speedtest/speedtest.go b/speedtest/speedtest.go
index 4323560..ac2bae5 100644
--- a/speedtest/speedtest.go
+++ b/speedtest/speedtest.go
@@ -258,8 +258,8 @@ func SpeedTest(c *cli.Context) error {
                log.Info("Selecting the fastest server based on ping")

                var wg sync.WaitGroup
-               jobs := make(chan PingJob, 10)
-               results := make(chan PingResult, 10)
+               jobs := make(chan PingJob, len(servers))
+               results := make(chan PingResult, len(servers))
                done := make(chan struct{})
maddie commented 3 years ago

Nice catch! Would you mind submitting a PR?

blnprasad commented 3 years ago

sure. I do not have permissions to push remote branch and raise PR.

maddie commented 3 years ago

You can fork the repo into your own namespace and make changes there, then you can submit PR from your repo.

blnprasad commented 3 years ago

thanks. i've raised PR for same.

maddie commented 3 years ago

Merged, thanks!

Closing this issue now.