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

Telegraf crashes with the following error: panic: runtime error: invalid memory address or nil pointer dereference #9044

Closed
placyd opened this issue Mar 24, 2021 · 4 comments · Fixed by #9048
Assignees
Labels
area/azure Azure plugins including eventhub_consumer, azure_storage_queue, azure_monitor bug unexpected problem or unintended behavior

Comments

@placyd
Copy link

placyd commented Mar 24, 2021

I was running telegraf 1.18.0-alpine on docker container on Azure App Service.

Relevant telegraf.conf:

[agent]
  interval = "20s"
  round_interval = true
  metric_batch_size = 1000
  metric_buffer_limit = 10000
  collection_jitter = "0s"
  flush_interval = "20s"
  flush_jitter = "0s"
  precision = ""
  hostname = ""
  omit_hostname = false
  debug = true


[[outputs.azure_monitor]]
  region = "northeurope"
  resource_id = "/subscriptions/*******/resourceGroups/*****/providers/Microsoft.Web/sites/****"
  namespace_prefix = "Telegraf_app/"

[[inputs.prometheus]]
  urls = ["https://*****.azurewebsites.net/metrics"]
  metric_version = 2

System info:

Telegraf in docker container: version: 1.18.0-alpine

Steps to reproduce:

launch telegraf

Expected behavior:

Sending logs to Azure monitor

Actual behavior:

Telegraf crashed.

Additional info:

logs:

- Container for ***** site ***** is unhealthy, Stopping site.
- Stopping site ***** because it is not healthy.
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0x22ebdd5]
goroutine 114 [running]:
github.com/influxdata/telegraf/plugins/outputs/azure_monitor.(*AzureMonitor).send(0xc00022b760, 0xc0004f0000, 0x21c7, 0x2800, 0x0, 0x0)
/go/src/github.com/influxdata/telegraf/plugins/outputs/azure_monitor/azure_monitor.go:348 +0x335
github.com/influxdata/telegraf/plugins/outputs/azure_monitor.(*AzureMonitor).Write(0xc00022b760, 0xc0000bd900, 0x26, 0x26, 0xc0000bd900, 0xc000535ee0)
/go/src/github.com/influxdata/telegraf/plugins/outputs/azure_monitor/azure_monitor.go:325 +0x5fa
github.com/influxdata/telegraf/models.(*RunningOutput).write(0xc0000ea900, 0xc0000bd900, 0x26, 0x26, 0x26, 0xc0003e7801)
/go/src/github.com/influxdata/telegraf/models/running_output.go:246 +0x99
github.com/influxdata/telegraf/models.(*RunningOutput).Write(0xc0000ea900, 0x86d5000, 0xf6000)
/go/src/github.com/influxdata/telegraf/models/running_output.go:203 +0x1f8
github.com/influxdata/telegraf/agent.(*Agent).flushOnce.func1(0xc00049c3c0, 0xc000bb9290)
/go/src/github.com/influxdata/telegraf/agent/agent.go:843 +0x27
created by github.com/influxdata/telegraf/agent.(*Agent).flushOnce
/go/src/github.com/influxdata/telegraf/agent/agent.go:842 +0x7a
@placyd placyd added the bug unexpected problem or unintended behavior label Mar 24, 2021
@telegraf-tiger telegraf-tiger bot added the area/azure Azure plugins including eventhub_consumer, azure_storage_queue, azure_monitor label Mar 24, 2021
@ivorybilled
Copy link
Contributor

Hi, is this happening when telegraf is shutting down and/or right after an occurs with the output plugin? Otherwise, I suspect based on the stack trace and a small oversight I just found (soon to be fixed), that your 'auth' object isn't being created properly, and ends up being nil.

We aren't handling the error if an error occurs while creating the auth object so it won't currently show what the issue is, but for now I'd suggest checking up on your authorization / environment variables that are used for azure auth to see if there might be any obvious issues. Let me know if this doesn't sound right.

@ivorybilled
Copy link
Contributor

Hi @placyd, if you'd like, could you grab a build from the pull request above and test if your panic still occurs?

@ivorybilled ivorybilled reopened this Mar 26, 2021
@placyd
Copy link
Author

placyd commented Mar 26, 2021

@jagularr Thank you for the quick improvement. I think we'll test it on Monday.

@placyd
Copy link
Author

placyd commented Mar 29, 2021

@jagularr looking on the fix I have no idea why but now Azure Monitor output plugin started working as expected. Thank you for your effort. I wish this fix will goes to official release soon.

@placyd placyd closed this as completed Apr 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/azure Azure plugins including eventhub_consumer, azure_storage_queue, azure_monitor bug unexpected problem or unintended behavior
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants