ffdo / node-informant

Small utility to collect node information in a Freifunk network via announced
7 stars 4 forks source link

collector crashes with empty values #15

Closed ghost closed 8 years ago

ghost commented 8 years ago
{
  "nodeinfo": {
    "nodeinfo": {
      "hostname": "dus0 (Mapserver)",
      "node_id": "dus0",
      "owner": {
        "contact": "xxx"
      },
      "software": {
        "firmware": {
          "base": "ArchLinux",
          "release": "rolling"
        }
      },
      "system": {
        "site_code": "ffdus"
      }
    }
  },
  "statistics": {
    "statistics": {
      "node_id": "dus0"
    }
  },
  "neighbours":{
    "neighbours":{
      "node_id":"dus0"
    }
  }
}

results in

panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xb code=0x1 addr=0x0 pc=0x4d2030]

goroutine 30 [running]:
github.com/dereulenspiegel/node-informant/gluon-collector/prometheus.(*TrafficCountPipe).Process.func1(0xc82011c000, 0xc8200c3540, 0xc82011c060)
    /opt/node-informant/src/github.com/dereulenspiegel/node-informant/gluon-collector/prometheus/pipes.go:130 +0x260
created by github.com/dereulenspiegel/node-informant/gluon-collector/prometheus.(*TrafficCountPipe).Process
    /opt/node-informant/src/github.com/dereulenspiegel/node-informant/gluon-collector/prometheus/pipes.go:137 +0x67

goroutine 1 [IO wait]:
net.runtime_pollWait(0x7f3ce45c5c50, 0x72, 0xc82000e210)
    /usr/lib/go/src/runtime/netpoll.go:157 +0x60
net.(*pollDesc).Wait(0xc8201d0220, 0x72, 0x0, 0x0)
    /usr/lib/go/src/net/fd_poll_runtime.go:73 +0x3a
net.(*pollDesc).WaitRead(0xc8201d0220, 0x0, 0x0)
    /usr/lib/go/src/net/fd_poll_runtime.go:78 +0x36
net.(*netFD).accept(0xc8201d01c0, 0x0, 0x7f3ce45c6720, 0xc8201b2940)
    /usr/lib/go/src/net/fd_unix.go:408 +0x27c
net.(*TCPListener).AcceptTCP(0xc8200245f8, 0xc82009b9a8, 0x0, 0x0)
    /usr/lib/go/src/net/tcpsock_posix.go:254 +0x4d
net/http.tcpKeepAliveListener.Accept(0xc8200245f8, 0x0, 0x0, 0x0, 0x0)
    /usr/lib/go/src/net/http/server.go:2135 +0x41
net/http.(*Server).Serve(0xc82011d7a0, 0x7f3ce45c66e8, 0xc8200245f8, 0x0, 0x0)
    /usr/lib/go/src/net/http/server.go:1887 +0xb3
net/http.(*Server).ListenAndServe(0xc82011d7a0, 0x0, 0x0)
    /usr/lib/go/src/net/http/server.go:1877 +0x136
net/http.ListenAndServe(0xc8201b6590, 0x5, 0x0, 0x0, 0x0, 0x0)
    /usr/lib/go/src/net/http/server.go:1967 +0x8f
github.com/dereulenspiegel/node-informant/gluon-collector/httpserver.StartHttpServerBlocking(0xc82009be28, 0x3, 0x3)
    /opt/node-informant/src/github.com/dereulenspiegel/node-informant/gluon-collector/httpserver/server.go:27 +0x4bf
main.Assemble(0x0, 0x0, 0x0, 0x0, 0x0)
    /opt/node-informant/src/github.com/dereulenspiegel/node-informant/gluon-collector/main.go:139 +0x7e7
main.main()
    /opt/node-informant/src/github.com/dereulenspiegel/node-informant/gluon-collector/main.go:235 +0x1b7

goroutine 17 [syscall, locked to thread]:
runtime.goexit()
    /usr/lib/go/src/runtime/asm_amd64.s:1721 +0x1

goroutine 5 [syscall]:
os/signal.loop()
    /usr/lib/go/src/os/signal/signal_unix.go:22 +0x18
created by os/signal.init.1
    /usr/lib/go/src/os/signal/signal_unix.go:28 +0x37

goroutine 21 [select]:
github.com/dereulenspiegel/node-informant/gluon-collector/scheduler.(*ScheduledJob).loop(0xc8200cf3e0)
    /opt/node-informant/src/github.com/dereulenspiegel/node-informant/gluon-collector/scheduler/scheduler.go:45 +0x139
github.com/dereulenspiegel/node-informant/gluon-collector/scheduler.NewJob.func1(0xc8200cf3e0)
    /opt/node-informant/src/github.com/dereulenspiegel/node-informant/gluon-collector/scheduler/scheduler.go:31 +0x21
created by github.com/dereulenspiegel/node-informant/gluon-collector/scheduler.NewJob
    /opt/node-informant/src/github.com/dereulenspiegel/node-informant/gluon-collector/scheduler/scheduler.go:32 +0xfe

goroutine 22 [select]:
github.com/dereulenspiegel/node-informant/gluon-collector/scheduler.(*ScheduledJob).loop(0xc8200cf420)
    /opt/node-informant/src/github.com/dereulenspiegel/node-informant/gluon-collector/scheduler/scheduler.go:45 +0x139
github.com/dereulenspiegel/node-informant/gluon-collector/scheduler.NewJob.func1(0xc8200cf420)
    /opt/node-informant/src/github.com/dereulenspiegel/node-informant/gluon-collector/scheduler/scheduler.go:31 +0x21
created by github.com/dereulenspiegel/node-informant/gluon-collector/scheduler.NewJob
    /opt/node-informant/src/github.com/dereulenspiegel/node-informant/gluon-collector/scheduler/scheduler.go:32 +0xfe

goroutine 23 [runnable]:
syscall.Syscall6(0x2c, 0x4, 0xc820151990, 0xe, 0x0, 0xc820162b1c, 0x1c, 0xe, 0xe, 0x0)
    /usr/lib/go/src/syscall/asm_linux_amd64.s:44 +0x5
syscall.sendto(0x4, 0xc820151990, 0xe, 0x10, 0x0, 0xc820162b1c, 0x1c, 0x0, 0x0)
    /usr/lib/go/src/syscall/zsyscall_linux_amd64.go:1729 +0x8c
syscall.Sendto(0x4, 0xc820151990, 0xe, 0x10, 0x0, 0x7f3ce45c4330, 0xc820162b00, 0x0, 0x0)
    /usr/lib/go/src/syscall/syscall_unix.go:258 +0xaf
net.(*netFD).writeTo(0xc8200c6e00, 0xc820151990, 0xe, 0x10, 0x7f3ce45c4330, 0xc820162b00, 0x0, 0x0, 0x0)
    /usr/lib/go/src/net/fd_unix.go:345 +0x1ae
net.(*UDPConn).WriteToUDP(0xc8200240d8, 0xc820151990, 0xe, 0x10, 0xb1e1e0, 0xe, 0x0, 0x0)
    /usr/lib/go/src/net/udpsock_posix.go:130 +0x776
net.(*UDPConn).WriteTo(0xc8200240d8, 0xc820151990, 0xe, 0x10, 0x7f3ce45c4d40, 0xb1e1e0, 0xc, 0x0, 0x0)
    /usr/lib/go/src/net/udpsock_posix.go:146 +0x329
github.com/dereulenspiegel/node-informant/announced.(*Requester).writeLoop(0xc8200cf560)
    /opt/node-informant/src/github.com/dereulenspiegel/node-informant/announced/announced.go:90 +0x1e4
created by github.com/dereulenspiegel/node-informant/announced.NewRequester
    /opt/node-informant/src/github.com/dereulenspiegel/node-informant/announced/announced.go:75 +0x407

goroutine 24 [runnable]:
runtime.Gosched()
    /usr/lib/go/src/runtime/proc.go:166 +0x14
github.com/dereulenspiegel/node-informant/announced.(*Requester).readLoop(0xc8200cf560)
    /opt/node-informant/src/github.com/dereulenspiegel/node-informant/announced/announced.go:130 +0x54c
created by github.com/dereulenspiegel/node-informant/announced.NewRequester
    /opt/node-informant/src/github.com/dereulenspiegel/node-informant/announced/announced.go:76 +0x42c

goroutine 25 [chan receive]:
github.com/dereulenspiegel/node-informant/announced.(*Requester).Receive(0xc8200cf560, 0xc820151370)
    /opt/node-informant/src/github.com/dereulenspiegel/node-informant/announced/announced.go:158 +0x6a
main.(*MultiReceiver).singleReceive(0xc8200cfcc0, 0x7f3ce45c5dd0, 0xc8200cf560)
    /opt/node-informant/src/github.com/dereulenspiegel/node-informant/gluon-collector/receiver.go:43 +0x62
created by main.NewMultiReceiver
    /opt/node-informant/src/github.com/dereulenspiegel/node-informant/gluon-collector/receiver.go:23 +0x31e

goroutine 26 [chan receive]:
github.com/dereulenspiegel/node-informant/gluon-collector/pipeline.(*DeflatePipe).Process.func1(0xc820017e00, 0xc820017e60)
    /opt/node-informant/src/github.com/dereulenspiegel/node-informant/gluon-collector/pipeline/deflatepipe.go:18 +0x9c
created by github.com/dereulenspiegel/node-informant/gluon-collector/pipeline.(*DeflatePipe).Process
    /opt/node-informant/src/github.com/dereulenspiegel/node-informant/gluon-collector/pipeline/deflatepipe.go:32 +0x5d

goroutine 27 [chan receive]:
github.com/dereulenspiegel/node-informant/gluon-collector/pipeline.(*JsonParsePipe).Process.func1(0xc820017e60, 0xc820017ec0)
    /opt/node-informant/src/github.com/dereulenspiegel/node-informant/gluon-collector/pipeline/parsejsonpipe.go:21 +0x92
created by github.com/dereulenspiegel/node-informant/gluon-collector/pipeline.(*JsonParsePipe).Process
    /opt/node-informant/src/github.com/dereulenspiegel/node-informant/gluon-collector/pipeline/parsejsonpipe.go:48 +0x5d

goroutine 28 [chan receive]:
github.com/dereulenspiegel/node-informant/gluon-collector/prometheus.(*NodeCountPipe).Process.func1(0xc820017f20, 0xc8200c3520, 0xc820017f80)
    /opt/node-informant/src/github.com/dereulenspiegel/node-informant/gluon-collector/prometheus/pipes.go:23 +0x7a
created by github.com/dereulenspiegel/node-informant/gluon-collector/prometheus.(*NodeCountPipe).Process
    /opt/node-informant/src/github.com/dereulenspiegel/node-informant/gluon-collector/prometheus/pipes.go:36 +0x67

goroutine 29 [chan receive]:
github.com/dereulenspiegel/node-informant/gluon-collector/prometheus.(*ClientCountPipe).Process.func1(0xc820017f80, 0xc8200c3530, 0xc82011c000)
    /opt/node-informant/src/github.com/dereulenspiegel/node-informant/gluon-collector/prometheus/pipes.go:74 +0x6e
created by github.com/dereulenspiegel/node-informant/gluon-collector/prometheus.(*ClientCountPipe).Process
    /opt/node-informant/src/github.com/dereulenspiegel/node-informant/gluon-collector/prometheus/pipes.go:88 +0x67

goroutine 31 [chan receive]:
github.com/dereulenspiegel/node-informant/gluon-collector/prometheus.(*NodeMetricCollector).Process.func1(0xc82011c060, 0xc8200c3550, 0xc82011c0c0)
    /opt/node-informant/src/github.com/dereulenspiegel/node-informant/gluon-collector/prometheus/pipes.go:165 +0xaa
created by github.com/dereulenspiegel/node-informant/gluon-collector/prometheus.(*NodeMetricCollector).Process
    /opt/node-informant/src/github.com/dereulenspiegel/node-informant/gluon-collector/prometheus/pipes.go:199 +0x67

goroutine 32 [chan receive]:
github.com/dereulenspiegel/node-informant/gluon-collector/collectors.(*GatewayCollector).Process.func1(0xc82011c0c0, 0xc8200c3560, 0xc82011c120)
    /opt/node-informant/src/github.com/dereulenspiegel/node-informant/gluon-collector/collectors/collectors.go:21 +0x5c
created by github.com/dereulenspiegel/node-informant/gluon-collector/collectors.(*GatewayCollector).Process
    /opt/node-informant/src/github.com/dereulenspiegel/node-informant/gluon-collector/collectors/collectors.go:32 +0x67

goroutine 33 [chan receive]:
github.com/dereulenspiegel/node-informant/gluon-collector/collectors.(*NodeinfoCollector).Process.func1(0xc82011c120, 0xc8200c3570, 0xc82011c180)
    /opt/node-informant/src/github.com/dereulenspiegel/node-informant/gluon-collector/collectors/collectors.go:45 +0x6e
created by github.com/dereulenspiegel/node-informant/gluon-collector/collectors.(*NodeinfoCollector).Process
    /opt/node-informant/src/github.com/dereulenspiegel/node-informant/gluon-collector/collectors/collectors.go:53 +0x67

goroutine 34 [chan receive]:
github.com/dereulenspiegel/node-informant/gluon-collector/collectors.(*StatisticsCollector).Process.func1(0xc82011c180, 0xc8200c3580, 0xc82011c1e0)
    /opt/node-informant/src/github.com/dereulenspiegel/node-informant/gluon-collector/collectors/collectors.go:66 +0x6b
created by github.com/dereulenspiegel/node-informant/gluon-collector/collectors.(*StatisticsCollector).Process
    /opt/node-informant/src/github.com/dereulenspiegel/node-informant/gluon-collector/collectors/collectors.go:73 +0x67

goroutine 35 [chan receive]:
github.com/dereulenspiegel/node-informant/gluon-collector/collectors.(*NeighbourInfoCollector).Process.func1(0xc82011c1e0, 0xc8200c3590, 0xc82011c240)
    /opt/node-informant/src/github.com/dereulenspiegel/node-informant/gluon-collector/collectors/collectors.go:86 +0x5c
created by github.com/dereulenspiegel/node-informant/gluon-collector/collectors.(*NeighbourInfoCollector).Process
    /opt/node-informant/src/github.com/dereulenspiegel/node-informant/gluon-collector/collectors/collectors.go:94 +0x67

goroutine 36 [chan receive]:
github.com/dereulenspiegel/node-informant/gluon-collector/collectors.(*StatusInfoCollector).Process.func1(0xc82011c240, 0xc8200c35a0, 0xc82011c2a0)
    /opt/node-informant/src/github.com/dereulenspiegel/node-informant/gluon-collector/collectors/collectors.go:112 +0x7a
created by github.com/dereulenspiegel/node-informant/gluon-collector/collectors.(*StatusInfoCollector).Process
    /opt/node-informant/src/github.com/dereulenspiegel/node-informant/gluon-collector/collectors/collectors.go:137 +0x67

goroutine 37 [chan receive]:
github.com/dereulenspiegel/node-informant/gluon-collector/pipeline.(*ProcessPipeline).Dequeue(0xc8200c35b0, 0x9b49a0)
    /opt/node-informant/src/github.com/dereulenspiegel/node-informant/gluon-collector/pipeline/pipeline.go:91 +0x51
github.com/dereulenspiegel/node-informant/gluon-collector/assemble.BuildPipelines.func1(0xc8200c35b0, 0x9b49a0)
    /opt/node-informant/src/github.com/dereulenspiegel/node-informant/gluon-collector/assemble/assemble.go:34 +0x2b
created by github.com/dereulenspiegel/node-informant/gluon-collector/assemble.BuildPipelines
    /opt/node-informant/src/github.com/dereulenspiegel/node-informant/gluon-collector/assemble/assemble.go:35 +0xca4

goroutine 38 [chan receive]:
main.(*MultiReceiver).Receive(0xc8200cfcc0, 0xc820151380)
    /opt/node-informant/src/github.com/dereulenspiegel/node-informant/gluon-collector/receiver.go:47 +0x69
github.com/dereulenspiegel/node-informant/gluon-collector/assemble.BuildPipelines.func2(0x7f3ce45c5e10, 0xc8200cfcc0, 0xc8200c3510)
    /opt/node-informant/src/github.com/dereulenspiegel/node-informant/gluon-collector/assemble/assemble.go:40 +0x62
created by github.com/dereulenspiegel/node-informant/gluon-collector/assemble.BuildPipelines
    /opt/node-informant/src/github.com/dereulenspiegel/node-informant/gluon-collector/assemble/assemble.go:41 +0xd0a

goroutine 39 [chan receive]:
github.com/dereulenspiegel/node-informant/gluon-collector/pipeline.(*ReceivePipeline).Dequeue(0xc8200c3510, 0xc820125f98)
    /opt/node-informant/src/github.com/dereulenspiegel/node-informant/gluon-collector/pipeline/pipeline.go:48 +0x51
github.com/dereulenspiegel/node-informant/gluon-collector/assemble.BuildPipelines.func3(0xc8200c3510, 0xc8200c35b0)
    /opt/node-informant/src/github.com/dereulenspiegel/node-informant/gluon-collector/assemble/assemble.go:47 +0x41
created by github.com/dereulenspiegel/node-informant/gluon-collector/assemble.BuildPipelines
    /opt/node-informant/src/github.com/dereulenspiegel/node-informant/gluon-collector/assemble/assemble.go:48 +0xd60

goroutine 42 [sleep]:
time.Sleep(0x5d21dba00)
    /usr/lib/go/src/runtime/time.go:59 +0xf9
main.Assemble.func3()
    /opt/node-informant/src/github.com/dereulenspiegel/node-informant/gluon-collector/main.go:126 +0x135
created by github.com/dereulenspiegel/node-informant/gluon-collector/scheduler.NewJob
    /opt/node-informant/src/github.com/dereulenspiegel/node-informant/gluon-collector/scheduler/scheduler.go:23 +0x34

goroutine 41 [select]:
github.com/dereulenspiegel/node-informant/gluon-collector/scheduler.(*ScheduledJob).loop(0xc82014adc0)
    /opt/node-informant/src/github.com/dereulenspiegel/node-informant/gluon-collector/scheduler/scheduler.go:45 +0x139
github.com/dereulenspiegel/node-informant/gluon-collector/scheduler.NewJob.func1(0xc82014adc0)
    /opt/node-informant/src/github.com/dereulenspiegel/node-informant/gluon-collector/scheduler/scheduler.go:31 +0x21
created by github.com/dereulenspiegel/node-informant/gluon-collector/scheduler.NewJob
    /opt/node-informant/src/github.com/dereulenspiegel/node-informant/gluon-collector/scheduler/scheduler.go:32 +0xfe

goroutine 43 [select]:
github.com/dereulenspiegel/node-informant/gluon-collector/scheduler.(*ScheduledJob).loop(0xc82014b380)
    /opt/node-informant/src/github.com/dereulenspiegel/node-informant/gluon-collector/scheduler/scheduler.go:45 +0x139
github.com/dereulenspiegel/node-informant/gluon-collector/scheduler.NewJob.func1(0xc82014b380)
    /opt/node-informant/src/github.com/dereulenspiegel/node-informant/gluon-collector/scheduler/scheduler.go:31 +0x21
created by github.com/dereulenspiegel/node-informant/gluon-collector/scheduler.NewJob
    /opt/node-informant/src/github.com/dereulenspiegel/node-informant/gluon-collector/scheduler/scheduler.go:32 +0xfe

goroutine 44 [select]:
github.com/dereulenspiegel/node-informant/gluon-collector/scheduler.(*ScheduledJob).loop(0xc82014b3c0)
    /opt/node-informant/src/github.com/dereulenspiegel/node-informant/gluon-collector/scheduler/scheduler.go:45 +0x139
github.com/dereulenspiegel/node-informant/gluon-collector/scheduler.NewJob.func1(0xc82014b3c0)
    /opt/node-informant/src/github.com/dereulenspiegel/node-informant/gluon-collector/scheduler/scheduler.go:31 +0x21
created by github.com/dereulenspiegel/node-informant/gluon-collector/scheduler.NewJob
    /opt/node-informant/src/github.com/dereulenspiegel/node-informant/gluon-collector/scheduler/scheduler.go:32 +0xfe

goroutine 45 [select]:
github.com/dereulenspiegel/node-informant/gluon-collector/scheduler.(*ScheduledJob).loop(0xc82014b400)
    /opt/node-informant/src/github.com/dereulenspiegel/node-informant/gluon-collector/scheduler/scheduler.go:45 +0x139
github.com/dereulenspiegel/node-informant/gluon-collector/scheduler.NewJob.func1(0xc82014b400)
    /opt/node-informant/src/github.com/dereulenspiegel/node-informant/gluon-collector/scheduler/scheduler.go:31 +0x21
created by github.com/dereulenspiegel/node-informant/gluon-collector/scheduler.NewJob
    /opt/node-informant/src/github.com/dereulenspiegel/node-informant/gluon-collector/scheduler/scheduler.go:32 +0xfe

while

{
  "nodeinfo": {
    "nodeinfo": {
      "hostname": "dus0 (Mapserver)",
      "node_id": "dus0",
      "owner": {
        "contact": "adorfer@nadeshda.org, me@petabyteboy.de"
      },
      "software": {
        "firmware": {
          "base": "ArchLinux",
          "release": "rolling"
        }
      },
      "system": {
        "site_code": "ffdus"
      }
    }
  },
  "statistics": {
    "statistics": {
      "node_id": "dus0",
      "traffic": {
        "tx": {
          "packets": 0,
          "dropped": 0,
          "bytes": 0
        },
        "rx": {
          "bytes": 0,
          "packets": 0
        },
        "forward": {
          "bytes": 0,
          "packets": 0
        },
        "mgmt_tx": {
          "bytes": 0,
          "packets": 0
        },
        "mgmt_rx": {
          "bytes": 0,
          "packets": 0
        }
      }
    }
  },
  "neighbours":{
    "neighbours":{
      "node_id":"dus0"
    }
  }
}

results in

ERRO[0000] Error marshalling nodes.json                  error=json: unsupported value: NaN string=NaN value=NaN  
ERRO[0010] New traffic value was smaller than the old value and the new traffic value even seemed to be negative  newTraffic={Bytes:0 Packets:0 Dropped:0} oldTraffic=&{Bytes:0 Packets:0 Dropped:0} value=0
dereulenspiegel commented 8 years ago

As of commit https://github.com/ffdo/node-informant/commit/1d66c32a55b4ce28a59288839db73c85f116e50c gluon-collector fix should be fixed.