sensu / uchiwa

Uchiwa is a simple yet effective open-source dashboard for the Sensu monitoring framework.
https://uchiwa.io
MIT License
920 stars 174 forks source link

Uchiwa segfaults in mapstructure's decodeStruct() #798

Closed agunnerson-ibm closed 5 years ago

agunnerson-ibm commented 6 years ago

Expected Behavior

Uchiwa should not crash with normal operation.

Current Behavior

Uchiwa is occasionally crashing with the following stack trace:

unexpected fault address 0x0
fatal error: fault
[signal SIGSEGV: segmentation violation code=0x80 addr=0x0 pc=0x4a41b8]

goroutine 1330086450 [running]:
runtime.throw(0x7aa65c, 0x5)
    /home/travis/.gimme/versions/go1.9.linux.amd64/src/runtime/panic.go:605 +0x95 fp=0xc422aa31a0 sp=0xc422aa3180 pc=0x42bb45
runtime.sigpanic()
    /home/travis/.gimme/versions/go1.9.linux.amd64/src/runtime/signal_unix.go:374 +0x227 fp=0xc422aa31f0 sp=0xc422aa31a0 pc=0x441727
reflect.StructTag.Lookup(0x70692e3739312d6e, 0x726f6c7078652e61, 0x7aeb89, 0xc, 0xc422aa3828, 0xc422aa3820, 0xc422aa3810)
    /home/travis/.gimme/versions/go1.9.linux.amd64/src/reflect/type.go:1165 +0x38 fp=0xc422aa3250 sp=0xc422aa31f0 pc=0x4a41b8
reflect.StructTag.Get(0x70692e3739312d6e, 0x726f6c7078652e61, 0x7aeb89, 0xc, 0x727940, 0xc4212aa1a8)
    /home/travis/.gimme/versions/go1.9.linux.amd64/src/reflect/type.go:1148 +0x49 fp=0xc422aa3298 sp=0xc422aa3250 pc=0x4a4159
github.com/sensu/uchiwa/vendor/github.com/mitchellh/mapstructure.(*Decoder).decodeStruct(0xc422fd3e88, 0x0, 0x0, 0x748a20, 0xc420e4b200, 0x778da0, 0xc4212aa180, 0x199, 0x200004bef21, 0x8)
    /home/travis/gopath/src/github.com/sensu/uchiwa/vendor/github.com/mitchellh/mapstructure/mapstructure.go:635 +0xe2a fp=0xc422aa3c28 sp=0xc422aa3298 pc=0x6c9faa
github.com/sensu/uchiwa/vendor/github.com/mitchellh/mapstructure.(*Decoder).decode(0xc422fd3e88, 0x0, 0x0, 0x748a20, 0xc420e4b200, 0x778da0, 0xc4212aa180, 0x199, 0x40d101, 0xc4212aa1c0)
    /home/travis/gopath/src/github.com/sensu/uchiwa/vendor/github.com/mitchellh/mapstructure/mapstructure.go:218 +0x65b fp=0xc422aa3d08 sp=0xc422aa3c28 pc=0x6c514b
github.com/sensu/uchiwa/vendor/github.com/mitchellh/mapstructure.(*Decoder).Decode(0xc422fd3e88, 0x748a20, 0xc420e4b200, 0x0, 0xc424630301)
    /home/travis/gopath/src/github.com/sensu/uchiwa/vendor/github.com/mitchellh/mapstructure/mapstructure.go:173 +0xb3 fp=0xc422aa3d68 sp=0xc422aa3d08 pc=0x6c4ac3
github.com/sensu/uchiwa/vendor/github.com/mitchellh/mapstructure.Decode(0x748a20, 0xc420e4b200, 0x71b2a0, 0xc4212aa180, 0xc422085ca8, 0x98ea20)
    /home/travis/gopath/src/github.com/sensu/uchiwa/vendor/github.com/mitchellh/mapstructure/mapstructure.go:115 +0xa4 fp=0xc422aa3da8 sp=0xc422aa3d68 pc=0x6c4694
github.com/sensu/uchiwa/uchiwa/daemon.findClientEvents(0xc420674570, 0xc421e92060, 0x72c8c0)
    /home/travis/gopath/src/github.com/sensu/uchiwa/uchiwa/daemon/clients.go:88 +0x454 fp=0xc422aa3ee8 sp=0xc422aa3da8 pc=0x6d4854
github.com/sensu/uchiwa/uchiwa/daemon.(*Daemon).buildClient(0xc4200e7b60, 0x748a20, 0xc420674570, 0xc423924320)
    /home/travis/gopath/src/github.com/sensu/uchiwa/uchiwa/daemon/clients.go:45 +0x2f0 fp=0xc422aa3fc0 sp=0xc422aa3ee8 pc=0x6d4260
runtime.goexit()
    /home/travis/.gimme/versions/go1.9.linux.amd64/src/runtime/asm_amd64.s:2337 +0x1 fp=0xc422aa3fc8 sp=0xc422aa3fc0 pc=0x459531
created by github.com/sensu/uchiwa/uchiwa/daemon.(*Daemon).buildClients
    /home/travis/gopath/src/github.com/sensu/uchiwa/uchiwa/daemon/clients.go:20 +0xc4

Possible Solution

I believe this is fixed by mitchellh/mapstructure@7869cdbd0bea0c846ad7b8b09bac31f34875aa11. Uchiwa just needs its vendored mapstructure dependency updated. I will submit a PR for this.

Steps to Reproduce (for bugs)

The issues seems to happen just by letting Uchiwa run for a while. I don't know of any way to get the bug to manifest earlier.

Your Environment

palourde commented 5 years ago

Closed by https://github.com/sensu/uchiwa/pull/799