Skip to content

Panic when telegraf reloads on watch #17372

@neelayu

Description

@neelayu

Relevant telegraf.conf

[[inputs.mem]]

[[outputs.http]]

Logs from Telegraf

2025-07-22T05:20:41Z I! Reloading Telegraf config
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x8 pc=0x10b194504]

goroutine 11 [running]:
time.(*Timer).Stop(...)
        /usr/local/go/src/time/sleep.go:114
main.(*Telegraf).watchLocalConfig(0x140012b4f20, {0x10eedd550, 0x140014e51d0}, 0x14001271b90, {0x16bb4b42e, 0x9})
        /go/src/github.com/influxdata/telegraf/cmd/telegraf/telegraf.go:278 +0x734
created by main.(*Telegraf).reloadLoop in goroutine 1
        /go/src/github.com/influxdata/telegraf/cmd/telegraf/telegraf.go:169 +0x6e0
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x8 pc=0x10b194504]

goroutine 8 [running]:
time.(*Timer).Stop(...)
        /usr/local/go/src/time/sleep.go:114
main.(*Telegraf).watchLocalConfig(0x140012b4f20, {0x10eedd550, 0x140014e51d0}, 0x14001271b90, {0x140014ac3f0, 0x14})
        /go/src/github.com/influxdata/telegraf/cmd/telegraf/telegraf.go:278 +0x734
created by main.(*Telegraf).reloadLoop in goroutine 1
        /go/src/github.com/influxdata/telegraf/cmd/telegraf/telegraf.go:162 +0x570

System info

Telegraf 1.35.2

Docker

No response

Steps to reproduce

  1. Run telegraf with --watch-config=notify
  2. Modify an existing config file loaded.
  3. Observe that Telegraf crashes.

Expected behavior

Should reload gracefully.

Actual behavior

Crashes due to panic

Additional info

Related to #17048

Metadata

Metadata

Assignees

Labels

bugunexpected problem or unintended behavior

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions