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

Missing error handling in the MySQL plugin leads to segmentation violation #2414

Closed
marieof9 opened this issue Feb 16, 2017 · 1 comment · Fixed by #2421
Closed

Missing error handling in the MySQL plugin leads to segmentation violation #2414

marieof9 opened this issue Feb 16, 2017 · 1 comment · Fixed by #2421
Assignees
Labels
bug unexpected problem or unintended behavior panic issue that results in panics from Telegraf
Milestone

Comments

@marieof9
Copy link

Upon start of telegraf it imminently exited with a segmentation violation.

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x20 pc=0x999806]

goroutine 52 [running]:
panic(0xf19ae0, 0xc420012050)
	/usr/local/go/src/runtime/panic.go:500 +0x1a1
database/sql.(*Rows).Next(0x0, 0x10a6d7f)
	/usr/local/go/src/database/sql/sql.go:1752 +0x26
github.com/influxdata/telegraf/plugins/inputs/mysql.(*Mysql).gatherGlobalStatuses(0xc420421420, 0xc420266210, 0xc42026c4b0, 0x4f, 0x18dfd20, 0xc420248e10, 0x0, 0xc420466730)
	/home/ubuntu/telegraf-build/src/github.com/influxdata/telegraf/plugins/inputs/mysql/mysql.go:860 +0xf5c
github.com/influxdata/telegraf/plugins/inputs/mysql.(*Mysql).gatherServer(0xc420421420, 0xc42026c4b0, 0x4f, 0x18dfd20, 0xc420248e10, 0x0, 0x0)
	/home/ubuntu/telegraf-build/src/github.com/influxdata/telegraf/plugins/inputs/mysql/mysql.go:550 +0x155
github.com/influxdata/telegraf/plugins/inputs/mysql.(*Mysql).Gather.func1(0xc4200fb950, 0xc420114068, 0xc420421420, 0x18dfd20, 0xc420248e10, 0xc420053771, 0x44)
	/home/ubuntu/telegraf-build/src/github.com/influxdata/telegraf/plugins/inputs/mysql/mysql.go:138 +0x89
created by github.com/influxdata/telegraf/plugins/inputs/mysql.(*Mysql).Gather
	/home/ubuntu/telegraf-build/src/github.com/influxdata/telegraf/plugins/inputs/mysql/mysql.go:139 +0x19a

The behaviour was triggered through miss configured file system permission. The query used to gather connection metrics from process list would simply return an error instead of a result.

mysql> SELECT user, sum(1) FROM INFORMATION_SCHEMA.PROCESSLIST GROUP BY user;
ERROR 1 (HY000): Can't create/write to file '/tmp/#sql_418_0.MYI' (Errcode: 13 - Permission denied)

For the SHOW GLOBAL STATUS query there is an error detection after the query. However for the
GatherProcessList and GatherUserStatistics this is missing and the non existent rows are iterated directly leading to a crash.

Version Information

  • Telegraf v1.1.1 (git: release-1.1.0 94de9dc)
  • Ubuntu 14.04.5 LTS
@sparrc sparrc added bug unexpected problem or unintended behavior panic issue that results in panics from Telegraf labels Feb 16, 2017
@sparrc sparrc added this to the 1.3.0 milestone Feb 16, 2017
sparrc added a commit that referenced this issue Feb 16, 2017
sparrc added a commit that referenced this issue Feb 16, 2017
@sparrc
Copy link
Contributor

sparrc commented Feb 17, 2017

thanks for the report! will get this fixed for version 1.3.

if anyone else hits this, the workaround is to disable gather_process_list & gather_user_statistics

sparrc added a commit that referenced this issue Feb 17, 2017
maxunt pushed a commit that referenced this issue Jun 26, 2018
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

Successfully merging a pull request may close this issue.

3 participants