prometheus / graphite_exporter

Server that accepts metrics via the Graphite protocol and exports them as Prometheus metrics
Apache License 2.0
356 stars 100 forks source link

GetMapping => SIGSEGV: segmentation violation #61

Closed jangrewe closed 5 years ago

jangrewe commented 5 years ago

Hi, i was using the latest tag and got the 0.4.1 image after i restarted the exporter, which suddenly started throwings SIGSEGV:

time="2018-11-25T15:36:31Z" level=info msg="Starting graphite_exporter (version=0.4.1, branch=HEAD, revision=f0d0670ab0e3b0e80876d0cd6b9c16dde6646dc3)" source="main.go:236"
time="2018-11-25T15:36:31Z" level=info msg="Build context (go=go1.11.2, user=root@c61ff3ba6d26, date=20181123-23:08:58)" source="main.go:237"
time="2018-11-25T15:36:31Z" level=info msg="Listening on :9108" source="main.go:308"
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x7c1102]

goroutine 135 [running]:
github.com/prometheus/graphite_exporter/vendor/github.com/prometheus/statsd_exporter/pkg/mapper/fsm.(*FSM).GetMapping(0xc000159aa0, 0xc00018c8a0, 0x19, 0x8e35aa, 0x8, 0xc0001b1b18, 0x1, 0xfad171d600000003, 0xc0001b1a90)
        /go/src/github.com/prometheus/graphite_exporter/vendor/github.com/prometheus/statsd_exporter/pkg/mapper/fsm/fsm.go:152 +0x282
github.com/prometheus/graphite_exporter/vendor/github.com/prometheus/statsd_exporter/pkg/mapper.(*MetricMapper).GetMapping(0xc00017ca00, 0xc00018c8a0, 0x19, 0x8e35aa, 0x8, 0x0, 0x0, 0xc0002c4000)
        /go/src/github.com/prometheus/graphite_exporter/vendor/github.com/prometheus/statsd_exporter/pkg/mapper/mapper.go:219 +0x605
main.(*graphiteCollector).processLine(0xc000159800, 0xc00018c8a0, 0x26)
        /go/src/github.com/prometheus/graphite_exporter/main.go:117 +0x18a
main.(*graphiteCollector).processReader(0xc000159800, 0x95fcc0, 0xc0005fa060)
        /go/src/github.com/prometheus/graphite_exporter/main.go:103 +0xe3
main.main.func1.1(0x966b80, 0xc0005fa060, 0xc000159800)
        /go/src/github.com/prometheus/graphite_exporter/main.go:271 +0x91
created by main.main.func1
        /go/src/github.com/prometheus/graphite_exporter/main.go:269 +0xce

My mapping file:

mappings:
- match: rspamd.actions.*
  name: rspamd_actions
  labels:
    action: $1
- match: rspamd.*
  name: rspamd_${1}

Example data sent (which triggers the SIGSEGV):

rspamd.actions.add_header 2 1543160310
rspamd.actions.greylist 0 1543160310
rspamd.actions.no_action 24 1543160310
rspamd.actions.reject 1 1543160310
rspamd.actions.rewrite_subject 0 1543160310
rspamd.actions.soft_reject 0 1543160310
rspamd.bytes_allocated 4165268944 1543160310
rspamd.chunks_allocated 4294966730 1543160310
rspamd.chunks_freed 0 1543160310
rspamd.chunks_oversized 1 1543160310
rspamd.connections 1 1543160310
rspamd.control_connections 1 1543160310
rspamd.ham_count 24 1543160310
rspamd.learned 2 1543160310
rspamd.pools_allocated 59 1543160310
rspamd.pools_freed 171 1543160310
rspamd.scanned 27 1543160310
rspamd.shared_chunks_allocated 34 1543160310
rspamd.spam_count 3 1543160310
StupidScience commented 5 years ago

Hello. Have the same issue with 0.4.1.

On version 0.3.0 everything works fine.

matthiasr commented 5 years ago

Thank you, this is very likely caused by #59. I will look into it tonight.

jangrewe commented 5 years ago

Seems to be working fine now, thank you! 👍

matthiasr commented 5 years ago

Thank you for the detailed report!

On Mon, Nov 26, 2018, 23:00 Jan Grewe notifications@github.com wrote:

Seems to be working fine now, thank you! 👍

— You are receiving this because you modified the open/close state.

Reply to this email directly, view it on GitHub https://github.com/prometheus/graphite_exporter/issues/61#issuecomment-441815331, or mute the thread https://github.com/notifications/unsubscribe-auth/AAICBnEkJxfEeNldhifrCOh26zM27hDtks5uzGSLgaJpZM4Yx7dj .