Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

filecount plugin: invalid memory address or nil pointer dereference #4845

Closed
c1982 opened this issue Oct 10, 2018 · 4 comments
Closed

filecount plugin: invalid memory address or nil pointer dereference #4845

c1982 opened this issue Oct 10, 2018 · 4 comments
Labels
bug unexpected problem or unintended behavior panic issue that results in panics from Telegraf
Milestone

Comments

@c1982
Copy link

c1982 commented Oct 10, 2018

Hi,

Telegraph app throw excetion about filecount plugin after then service is stop.

System info

Windows Server 2012 R2 v6.3 build 3600

Config

[[inputs.filecount]]
directory = "C:\\app\\data\\que"
name = "*.log"
recursive = false
regular_only = false
size = 0

Error

panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xc0000005 code=0x0 addr=0x18 pc=0xce7d41]

goroutine 216 [running]:
github.com/influxdata/telegraf/plugins/inputs/filecount.count.func1(0xc04288e380, 0x3a, 0x0, 0x0, 0x2190fa0, 0xc042716090, 0x0, 0x0)
        /go/src/github.com/influxdata/telegraf/plugins/inputs/filecount/filecount.go:134 +0x81
path/filepath.walk(0xc042386620, 0x15, 0x21afd20, 0xc042a70000, 0xc042716030, 0x0, 0x30)
        /usr/local/go/src/path/filepath/path.go:377 +0x214
path/filepath.Walk(0xc042386620, 0x15, 0xc042716030, 0x1, 0xc042716000)
        /usr/local/go/src/path/filepath/path.go:403 +0x10d
github.com/influxdata/telegraf/plugins/inputs/filecount.count(0xc042386620, 0x15, 0x0, 0xc042716000, 0x0, 0x0)
        /go/src/github.com/influxdata/telegraf/plugins/inputs/filecount/filecount.go:139 +0x8f
github.com/influxdata/telegraf/plugins/inputs/filecount.(*FileCount).Gather(0xc0420c8320, 0x21b0c80, 0xc042122680, 0x0, 0xc04237e000)
        /go/src/github.com/influxdata/telegraf/plugins/inputs/filecount/filecount.go:183 +0xdc
github.com/influxdata/telegraf/agent.gatherWithTimeout.func1(0xc04208a360, 0xc042094e40, 0x21b0c80, 0xc042122680)
        /go/src/github.com/influxdata/telegraf/agent/agent.go:153 +0x4e
created by github.com/influxdata/telegraf/agent.gatherWithTimeout
        /go/src/github.com/influxdata/telegraf/agent/agent.go:152 +0xdb

Expected behavior:

telegraf windows service must be work ^_^

Actual behavior:

Service is stop

@danielnelson danielnelson added bug unexpected problem or unintended behavior panic issue that results in panics from Telegraf labels Oct 11, 2018
@danielnelson danielnelson added this to the 1.8.2 milestone Oct 11, 2018
@glinton
Copy link
Contributor

glinton commented Oct 11, 2018

@c1982 what version of telegraf are you using here?

@c1982
Copy link
Author

c1982 commented Oct 11, 2018

Telegraf 1.8.1 windows_amd64

@glinton
Copy link
Contributor

glinton commented Oct 11, 2018

Thanks, there have been some changes since 1.8.1 that may address this issue, is it possible for you to try with a nightly build? Thanks

@c1982
Copy link
Author

c1982 commented Oct 11, 2018

Hi @glinton

Thanks for response.

I tested with your nighly build version, unfortunately not working.

ps: I count SMTP server queue with this plugin. Has a lot of write and delete file job in production.

Telegram Log

2018-10-11T20:56:00Z I! Starting Telegraf
2018-10-11T20:56:00Z I! Loaded inputs: inputs.win_perf_counters inputs.filecount
2018-10-11T20:56:00Z I! Loaded aggregators:
2018-10-11T20:56:00Z I! Loaded processors:
2018-10-11T20:56:00Z I! Loaded outputs: influxdb
2018-10-11T20:56:00Z I! Tags enabled: host=SMTP2
2018-10-11T20:56:00Z I! Agent Config: Interval:5s, Quiet:false, Hostname:"SMTP2", Flush Interval:10s

Error

C:\Program Files\telegraf>telegraf.exe -config=telegraf.conf
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xc0000005 code=0x0 addr=0x30 pc=0xce9196]

goroutine 307 [running]:
github.com/influxdata/telegraf/plugins/inputs/filecount.(*FileCount).nameFilter.
func1(0x0, 0x0, 0x21976e0, 0xc042935aa0, 0x6a)
        /go/src/github.com/influxdata/telegraf/plugins/inputs/filecount/filecoun
t.go:83 +0x36
github.com/influxdata/telegraf/plugins/inputs/filecount.(*FileCount).filter(0xc0
421afce0, 0x0, 0x0, 0xc0423c9d48, 0x4b9924, 0xc042aea240)
        /go/src/github.com/influxdata/telegraf/plugins/inputs/filecount/filecoun
t.go:191 +0x8c
github.com/influxdata/telegraf/plugins/inputs/filecount.(*FileCount).count.func1
(0xc042aea240, 0x2b, 0x0, 0x0, 0x2195700, 0xc042490ae0, 0x0, 0x0)
        /go/src/github.com/influxdata/telegraf/plugins/inputs/filecount/filecoun
t.go:145 +0x87
path/filepath.walk(0xc0420988da, 0x6, 0x21b4440, 0xc04266e060, 0xc04271c640, 0x0
, 0x40)
        /usr/local/go/src/path/filepath/path.go:377 +0x214
path/filepath.Walk(0xc0420988da, 0x6, 0xc04271c640, 0x0, 0x1b2a020)
        /usr/local/go/src/path/filepath/path.go:403 +0x10d
github.com/influxdata/telegraf/plugins/inputs/filecount.(*FileCount).count(0xc04
21afce0, 0x21b53a0, 0xc0423dbde0, 0xc0420988da, 0x6, 0x0)
        /go/src/github.com/influxdata/telegraf/plugins/inputs/filecount/filecoun
t.go:159 +0xf0
github.com/influxdata/telegraf/plugins/inputs/filecount.(*FileCount).Gather(0xc0
421afce0, 0x21b53a0, 0xc0423dbde0, 0x0, 0x0)
        /go/src/github.com/influxdata/telegraf/plugins/inputs/filecount/filecoun
t.go:211 +0xc0
github.com/influxdata/telegraf/agent.gatherWithTimeout.func1(0xc0426e13e0, 0xc04
23f1600, 0x21b53a0, 0xc0423dbde0)
        /go/src/github.com/influxdata/telegraf/agent/agent.go:153 +0x4e
created by github.com/influxdata/telegraf/agent.gatherWithTimeout
        /go/src/github.com/influxdata/telegraf/agent/agent.go:152 +0xdb

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug unexpected problem or unintended behavior panic issue that results in panics from Telegraf
Projects
None yet
Development

No branches or pull requests

3 participants