toni-moreno / snmpcollector

A full featured Generic SNMP data collector with Web Administration Interface for InfluxDB
MIT License
286 stars 53 forks source link

[Bug] non-positive interval for NewTicker #510

Closed gmwiku closed 2 years ago

gmwiku commented 2 years ago

snmpcollector | time="2021-11-15 09:08:49" level=info msg="Main agent Logging will be written to " snmpcollector | panic: non-positive interval for NewTicker snmpcollector | snmpcollector | goroutine 537 [running]: snmpcollector | time.NewTicker(0xffffffba269b4800, 0xc0171348c0) snmpcollector | /usr/local/go/src/time/tick.go:24 +0x151 snmpcollector | github.com/toni-moreno/snmpcollector/pkg/data/measurement.(Measurement).GatherLoop(0xc0004b6900, 0xc00042b800, 0x0, 0xdd1780, 0xc001257320, 0xc0004437d0, 0x24, 0x0, 0xc0004ed6c0, 0xd, ...) snmpcollector | /go/src/github.com/toni-moreno/snmpcollector/pkg/data/measurement/measurement.go:995 +0x265 snmpcollector | github.com/toni-moreno/snmpcollector/pkg/agent/device.(SnmpDevice).StartGather.func1(0xc0008014f4, 0xc000952d00, 0xc0003a8e40, 0xc00017f7a0, 0xc000854730, 0xc0004b6900) snmpcollector | /go/src/github.com/toni-moreno/snmpcollector/pkg/agent/device/snmpdevice.go:536 +0x345 snmpcollector | created by github.com/toni-moreno/snmpcollector/pkg/agent/device.(*SnmpDevice).StartGather snmpcollector | /go/src/github.com/toni-moreno/snmpcollector/pkg/agent/device/snmpdevice.go:515 +0x7a5 snmpcollector exited with code 2

gmwiku commented 2 years ago

Previous version runs smoothly.

sbengo commented 2 years ago

Hi @gmwiku , thanks for submitting this.

We will review this ASAP, just a question in order to have an idea of what can be happening:

Thanks, Regards!

gmwiku commented 2 years ago
  • Can provide seme SNMPDevice CFG?

Unfortunatelly I'm not allowed to share this information.

  • Do you have some device with -1 as UpdateFilterFrequency?

Yes, 1 of 283 devices has such setting, I can try to change it and test if it helps. :)

sbengo commented 2 years ago

I'm afraid that there is some problem with the -1 support, as the FilterFreq feature has been refactored and set it up as a Ticker.

Thanks for the information, we will try to fix this ASAP!

Thanks, Regards!

gmwiku commented 2 years ago

I'm afraid that there is some problem with the -1 support, as the FilterFreq feature has been refactored and set it up as a Ticker.

After update FilterFreq to some positive value the problem disappeared. Thanks a lot for your tip.

BTW I'm not sure if it is related to JS libraries or to the browser, but under Chrome for Linux (Wersja 96.0.4664.45 (Oficjalna wersja) (64-bitowa)) "Device status" page doesn't contain any items, only the headers of the table and there are some errors in browser console:

vendor.c4bdd793bac7a4707054.bundle.js:1 ERROR TypeError: Cannot read properties of undefined (reading 'toString')
    at main.fd1107faf03ac8424150.bundle.js:1
    at Array.forEach (<anonymous>)
    at main.fd1107faf03ac8424150.bundle.js:1
    at Array.forEach (<anonymous>)
    at l.changeFilter (main.fd1107faf03ac8424150.bundle.js:1)
    at l.onChangeTable (main.fd1107faf03ac8424150.bundle.js:1)
    at e._next (main.fd1107faf03ac8424150.bundle.js:1)
    at e.__tryOrUnsub (vendor.c4bdd793bac7a4707054.bundle.js:1)
    at e.next (vendor.c4bdd793bac7a4707054.bundle.js:1)
    at e._next (vendor.c4bdd793bac7a4707054.bundle.js:1)

In another browser there is no problem. :)

sbengo commented 2 years ago

I think it can be the first time that the dev status is loaded and it is not connected yet. I think that we missed some checks (dev properties) in order to ensure that all data is available to be shown.

Thanks for submitting this, I will try to repro and will open a new issue, I will remain this one to the -1 support.

Thanks, Regards!

gmwiku commented 2 years ago

Problem with JS library and/or browser is not valid any more ... probably some library has been cached, now Device status page is displayed properly. snmpcollector also works stable. So the only valid issue in this thread is UpdateFilterFrequency equal to -1 - according to displayed popup tip -1 value is still allowed and recomended in the case we don't want filter updates.