ziutek / rrd

Bindings to rrdtool
Other
147 stars 44 forks source link

Segfault in rrd.Info() #14

Open ushis opened 10 years ago

ushis commented 10 years ago

Hello,

i was playing around with your rrd package and produced some segfaults using the rrd.Info() function with rrdtool 1.4.8.

Here is my sample program:

package main

import (
  "fmt"
  "os"
  "github.com/ziutek/rrd"
)

func main() {
  info, err := rrd.Info(os.Args[1])

  if err != nil {
    fmt.Println(err)
    os.Exit(1)
  }

  for k, v := range info {
    fmt.Println(k, ":", v)
  }
}

And the trace:

unexpected fault address 0x0
fatal error: fault
[signal 0xb code=0x80 addr=0x0 pc=0x42087a]

goroutine 1 [running]:
runtime.throw(0x781b57)
    /usr/lib/go/src/pkg/runtime/panic.c:464 +0x69 fp=0x7f686fd00c20
runtime.sigpanic()
    /usr/lib/go/src/pkg/runtime/os_linux.c:237 +0xe9 fp=0x7f686fd00c38
runtime.findnull(0x208d88000000000)
    /usr/lib/go/src/pkg/runtime/string.goc:22 +0x1a fp=0x7f686fd00c48
runtime.gostring(0x7f686fd00ca0, 0x208d88000000000)
    /usr/lib/go/src/pkg/runtime/string.goc:67 +0x27 fp=0x7f686fd00c80
github.com/ziutek/rrd._Cfunc_GoString(0x208d88000000000, 0x10, 0x0)
    github.com/ziutek/rrd/_obj/_cgo_defun.c:11 +0x31 fp=0x7f686fd00c98
github.com/ziutek/rrd.updateInfoValue(0x208d850, 0x0, 0x0, 0x8, 0x4e8580)
    /home/ushi/.go/src/github.com/ziutek/rrd/rrd_c.go:295 +0xd7 fp=0x7f686fd00d28
github.com/ziutek/rrd.parseRRDInfo(0x208d850, 0x0)
    /home/ushi/.go/src/github.com/ziutek/rrd/rrd_c.go:341 +0x477 fp=0x7f686fd00e08
github.com/ziutek/rrd.Info(0x7fff9e62c9cf, 0x8, 0x0, 0x0, 0x0)
    /home/ushi/.go/src/github.com/ziutek/rrd/rrd_c.go:408 +0xe4 fp=0x7f686fd00e38
main.main()
    /tmp/test.go:10 +0x52 fp=0x7f686fd00f48
runtime.main()
    /usr/lib/go/src/pkg/runtime/proc.c:220 +0x11f fp=0x7f686fd00fa0
runtime.goexit()
    /usr/lib/go/src/pkg/runtime/proc.c:1394 fp=0x7f686fd00fa8

goroutine 3 [syscall]:
runtime.goexit()
    /usr/lib/go/src/pkg/runtime/proc.c:1394
exit status 2

Tell me, if you need the rrd file or additional info. My first guess is, that the string is not properly 0 terminated, but it is just a guess.

Cheers, ushi

ziutek commented 10 years ago

RRD file can help fix this issue. Can you send it to me or public it somewhere (eg. on your github account)?

ushis commented 10 years ago

Here it is: https://www.dropbox.com/s/z99pj34edxp0x2h/load.rrd