ericmann / speed-logger

Log network speed to a CSV routinely.
28 stars 20 forks source link

RangeError: Invalid array length #10

Open graham73may opened 3 years ago

graham73may commented 3 years ago

Hi,

I installed the required scripts, run it with node speed.js.

After a few automated runs, the Upload data starts to fail/cause an error (it always seems to be the upload?). I stopped the script, started again and it's working fine again.

The output is:


 Running test ...
2020-12-05 11:44:43 => IP: 111.111.111.111 | Ping: 12.287ms | Download: 29.25 MB/s | Upload: 9.22 MB/s | Server: GTT.net
PING
      12.89 ┤ ╭╮ 
      12.71 ┤ ││ 
      12.52 ┤ ││ 
      12.34 ┤ │╰ 
      12.15 ┤ │  
      11.97 ┤ │  
      11.79 ┤ │  
      11.60 ┤ │  
      11.42 ┼╮│  
      11.23 ┤││  
      11.05 ┤╰╯  

Download
        46 ┤╭╮  
        44 ┤││  
        42 ┤│╰╮ 
        40 ┤│ │ 
        38 ┤│ │ 
        37 ┤│ │ 
        35 ┤│ │ 
        33 ┤│ │ 
        31 ┤│ │ 
        29 ┤│ ╰ 
        27 ┼╯   

Upload
Error parsing data from speedtest.net: {"client": {"rating": "0", "loggedin": "0", "isprating": "3.7", "ispdlavg": "0", "ip": "111.111.111.111", "isp": "ABC", "lon": "-0.0000", "ispulavg": "0", "country": "XX", "lat": "00.0000"}, "bytes_sent": 13082624, "download": 29248644.222090553, "timestamp": "2020-12-05T11:44:20.549590Z", "share": null, "bytes_received": 36658672, "ping": 12.287, "upload": 9223515.610125469, "server": {"latency": 12.287, "name": "XXXXX", "url": "http://slo.speedtest.gtt.net:8080/speedtest/upload.php", "country": "XXXXXXX", "lon": "-0.0000", "cc": "XX", "host": "slo.speedtest.gtt.net:8080", "sponsor": "GTT.net", "lat": "0.0000", "id": "24387", "d": 20.241715607079836}}

RangeError: Invalid array length
    at Object.exports.plot (/Applications/MAMP/htdocs/speed-logger/node_modules/asciichart/asciichart.js:29:22)
    at Socket.<anonymous> (/Applications/MAMP/htdocs/speed-logger/speed.js:195:30)
    at Socket.emit (events.js:165:20)
    at addChunk (_stream_readable.js:269:12)
    at readableAddChunk (_stream_readable.js:252:13)
    at Socket.Readable.push (_stream_readable.js:213:10)
    at Pipe.onread (net.js:602:20)

(identifiable data replace with dummy content)

Not sure what other information is useful, running on MacOS. display was off but network is set to keep alive.

Thanks!


EDIT: It seems to be node_modules/asciichart/asciichart.js so I'm going to try enableCLICharts: false for a bit instead...

graham73may commented 3 years ago

Also encountered this with CLI charts disabled

 Running test ...
2020-12-05 21:34:14 => IP: 111.111.111.111 | Ping: 13.092ms | Download: 18.93 MB/s | Upload: 9.53 MB/s | Server: Iomart
Error parsing data from speedtest.net: 

SyntaxError: Unexpected end of JSON input
    at JSON.parse (<anonymous>)
    at Socket.<anonymous> (/Applications/MAMP/htdocs/speed-logger/speed.js:157:19)
    at Socket.emit (events.js:165:20)
    at addChunk (_stream_readable.js:269:12)
    at readableAddChunk (_stream_readable.js:252:13)
    at Socket.Readable.push (_stream_readable.js:213:10)
    at Pipe.onread (net.js:602:20)