layou233/NeverIdle

getting "panic: invalid argument to Int31n" with version 0.2

ma-schroeder opened this issue · 6 comments

Hi there,

i'm getting the following error when starting version 0.2

Start:

./NeverIdle -c 1h -n 3h > NeverIdle.log 2>&1 &

Logfile shows:

====================
Starting CPU wasting with interval 1h0m0s
====================
====================
Starting network speed testing with interval 3h0m0s
====================
[CPU] Successfully wasted on 2023-03-04 11:17:16.885686988 +0000 GMT m=+0.009873685
panic: invalid argument to Int31n

goroutine 17 [running]:
math/rand.(*Rand).Int31n(0x0?, 0x0?)
        math/rand/rand.go:138 +0xdb
math/rand.Int31n(...)
        math/rand/rand.go:353
github.com/layou233/neveridle/waste.Network(0x0?)
        github.com/layou233/neveridle/waste/network.go:35 +0x211
created by main.main
        ./main.go:52 +0x69d

Version 0.1 works.

uname -a
Linux 4.14.35-2047.522.3.el7uek.x86_64 #2 SMP Fri Jan 20 16:05:02 PST 2023 x86_64 x86_64 x86_64 GNU/Linux

Image is "Oracle-Linux-7.7-2019.08.28-0"

Thanks

It occurs when the number of the available servers equals to 0.

What's the network waste result in 0.1 on your machine? Is it all bad (latency<=0 or something)?

The log from v0.1 shows:

[NETWORK] SpeedTest Ping: 199.889543ms , 80.10973168185723 , Upload: 345.6228024505668 via [53864]     3.81km
Frankfurt Am Main (Germany) by Batternhosting

Its on the same machine, stopping v0.1 and starting v0.2 here results in the error, stoping v0.2 and starting 0.1 (different directories) works

@r3inbowari Any ideas for this?

I have made a simple patch so that it would not crash at least, and will attempt to retry in seconds.

BTW everything is fine on my Oracle ARM (Singapore), Ubuntu 20.04:

root@sg-arm:~# ./NeverIdle-linux-arm64 -n 1s
NeverIdle 0.2.1 - Getting worse from here.
Platform: linux , arm64 , go1.20.1
GitHub: https://github.com/layou233/NeverIdle
====================
Starting network speed testing with interval 1s
====================
[NETWORK] SpeedTest Ping: 898.89µs , Download: 3863.898102 , Upload: 3158.966678 via [50344] 15093.84km 
Singapore (Singapore) by GSL Networks

^C
root@sg-arm:~# 

Hi, @layou233 This is caused by a ping exception in v1.4.1. Because @ma-schroeder does not have root privileges. It can be solved by upgrading speedtest-go to the latest version. I think it should be updated as soon as possible, because v0.2 is not working properly on Oracle servers which no root.

@r3inbowari I added Renovate bot to update dependencies automatically. I hope it works. Thanks a ton!

@ma-schroeder I will release v0.2.2 later and please try it. :D

Hi there,

thank you. This is now looking good:

~/tools/ni22]> ./NeverIdle -n 1m
NeverIdle 0.2.2 - Getting worse from here.
Platform: linux , amd64 , go1.20.1
GitHub: https://github.com/layou233/NeverIdle
====================
Starting network speed testing with interval 1m0s
====================
[NETWORK] SpeedTest Ping: 1.156921ms , Download: 478.1585 , Upload: 270.9301 mainServer [23095]     3.81km
Frankfurt (Germany) by 31173 Services AB