showwin/speedtest-go

linux error:signal: killed

andy-hsiung opened this issue · 21 comments

"In macOS, this is no issue. However, when running on Linux, the following error occurs: signal: killed."
Code:
`package main

import (
"fmt"
"github.com/showwin/speedtest-go/speedtest"
)

func main() {
var speedtestClient = speedtest.New()

// Use a proxy for the speedtest. eg: socks://127.0.0.1:7890
// speedtest.WithUserConfig(&speedtest.UserConfig{Proxy: "socks://127.0.0.1:7890"})(speedtestClient)

// Select a network card as the data interface.
// speedtest.WithUserConfig(&speedtest.UserConfig{Source: "192.168.1.101"})(speedtestClient)

// Get user's network information
// user, _ := speedtestClient.FetchUserInfo()

// Get a list of servers near a specified location
// user.SetLocationByCity("Tokyo")
// user.SetLocation("Osaka", 34.6952, 135.5006)

// Search server using serverID.
// eg: fetch server with ID 28910.
// speedtest.ErrServerNotFound will be returned if the server cannot be found.
// server, err := speedtest.FetchServerByID("28910")

serverList, _ := speedtestClient.FetchServers()
targets, _ := serverList.FindServer([]int{})

for _, s := range targets {
	// Please make sure your host can access this test server,
	// otherwise you will get an error.
	// It is recommended to replace a server at this time
	s.PingTest(nil)
	s.DownloadTest()
	s.UploadTest()
	fmt.Printf("Latency: %s, Download: %f, Upload: %f\n", s.Latency, s.DLSpeed, s.ULSpeed)
}

}`

Hi, @pabcxyz, Can I use strace or dmesg for debugging.

@r3inbowari https://github.com/showwin/speedtest-go/issues/95 ,In this issue, you mentioned a .zip file that worked for me. Where can I find the corresponding code?

@r3inbowari https://github.com/showwin/speedtest-go/issues/95 ,In this issue, you mentioned a .zip file that worked for me. Where can I find the corresponding code?

They use almost the same code. use speedtest-go@v1.4.0

var speedtestClient = speedtest.New()
# Try adding debug line, can you see anything?
speedtest.WithUserConfig(&speedtest.UserConfig{Debug: true})(speedtestClient)

speedtest-go_linux_amd64.zip I compiled this, you can try it.

@r3inbowari This .zip file doesn't work; it has the same issue as the one I mentioned.

@r3inbowari server A is configured with 4 vCPUs and 8 GiB of RAM, server B is configured with 4 vCPUs and 16 GiB of RAM. When I run the program on server A, it throws this error, but it works fine on server B. I believe this program has specific memory requirements. I hope for a quick fix.now,What should I do now to be able to use this package? Could you please advise?

Can you provide server A system information

@r3inbowari Sure, but what specific system information do you need?

kernel and os release

CentOS Linux release 7.6.1810 (Core)

A and B are same?

Yes, apart from the system configuration。

Any clues about dmesg?

Hi, @pabcxyz, Can I use strace or dmesg for debugging.

image image I only captured a fragment.

where is the kill signal you mentioned?

oom?

Any clues about dmesg?

Hi, @pabcxyz, Can I use strace or dmesg for debugging.

dmesg | egrep -i -B100 'killed process'

Sorry, I didn't quite understand what you meant. Currently, this is all I can provide.

This issue seems to occur after #142.