{"action":"closed","issue":{"url":"https://api.github.com/repos/influxdata/telegraf/issues/1188","repository_url":"https://api.github.com/repos/influxdata/telegraf","labels_url":"https://api.github.com/repos/influxdata/telegraf/issues/1188/labels{/name}","comments_url":"https://api.github.com/repos/influxdata/telegraf/issues/1188/comments","events_url":"https://api.github.com/repos/influxdata/telegraf/issues/1188/events","html_url":"https://github.com/influxdata/telegraf/issues/1188","id":154475179,"number":1188,"title":"[0.12.1-1] too many opened files","user":{"login":"deric","id":138573,"avatar_url":"https://avatars.githubusercontent.com/u/138573?v=3","gravatar_id":"","url":"https://api.github.com/users/deric","html_url":"https://github.com/deric","followers_url":"https://api.github.com/users/deric/followers","following_url":"https://api.github.com/users/deric/following{/other_user}","gists_url":"https://api.github.com/users/deric/gists{/gist_id}","starred_url":"https://api.github.com/users/deric/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/deric/subscriptions","organizations_url":"https://api.github.com/users/deric/orgs","repos_url":"https://api.github.com/users/deric/repos","events_url":"https://api.github.com/users/deric/events{/privacy}","received_events_url":"https://api.github.com/users/deric/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-05-12T12:54:00Z","updated_at":"2016-05-18T11:15:35Z","closed_at":"2016-05-18T11:15:35Z","body":"In case when InfluxDB crashes telegraf keeps opened too many connections:\r\n\r\n```\r\n$ lsof | grep telegraf | wc -l\r\n23690\r\n```\r\nwhich might lead to situation where host runs out of file descriptors. If we assume that target DB is always available (which would be nice) this situation couldn't happen. But we don't live in an ideal world and this behavior might crash other services on the host.\r\n\r\n```\r\nay 12 12:44:20 psql02a telegraf[848]: 2016/05/12 12:44:20 Error in input [diskio]: error getting disk io info: open /proc/diskstats: too many open files\r\nMay 12 12:44:20 psql02a telegraf[848]: 2016/05/12 12:44:20 Error in input [disk]: error getting disk usage info: open /etc/mtab: too many open files\r\nMay 12 12:44:20 psql02a telegraf[848]: 2016/05/12 12:44:20 Error in input [net]: error getting net io info: open /proc/net/dev: too many open files\r\nMay 12 12:44:20 psql02a telegraf[848]: 2016/05/12 12:44:20 FATAL: Input [cpu] panicked: runtime error: index out of range, Stack:\r\nMay 12 12:44:20 psql02a telegraf[848]: goroutine 5673051 [running]:\r\nMay 12 12:44:20 psql02a telegraf[848]: github.com/influxdata/telegraf/agent.panicRecover(0xc82034a780)\r\nMay 12 12:44:20 psql02a telegraf[848]: /home/ubuntu/telegraf-build/src/github.com/influxdata/telegraf/agent/agent.go:96 +0xa9\r\nMay 12 12:44:20 psql02a telegraf[848]: panic(0x10241a0, 0xc82000e050)\r\nMay 12 12:44:20 psql02a telegraf[848]: /usr/local/go/src/runtime/panic.go:426 +0x4e9\r\nMay 12 12:44:20 psql02a telegraf[848]: github.com/shirou/gopsutil/cpu.parseStatLine(0x11c43f8, 0x0, 0x1, 0x0, 0x0)\r\nMay 12 12:44:20 psql02a telegraf[848]: /home/ubuntu/telegraf-build/src/github.com/shirou/gopsutil/cpu/cpu_linux.go:169 +0x9e4\r\nMay 12 12:44:20 psql02a telegraf[848]: github.com/shirou/gopsutil/cpu.CPUTimes(0x0, 0x0, 0x0, 0x0, 0x0, 0x0)\r\nMay 12 12:44:20 psql02a telegraf[848]: /home/ubuntu/telegraf-build/src/github.com/shirou/gopsutil/cpu/cpu_linux.go:49 +0x2e3\r\nMay 12 12:44:20 psql02a telegraf[848]: github.com/influxdata/telegraf/plugins/inputs/system.(*systemPS).CPUTimes(0x1bda028, 0x100, 0x0, 0x0, 0x0, 0x0, 0x0)\r\nMay 12 12:44:20 psql02a telegraf[848]: /home/ubuntu/telegraf-build/src/github.com/influxdata/telegraf/plugins/inputs/system/ps.go:45 +0x22e\r\nMay 12 12:44:20 psql02a telegraf[848]: github.com/influxdata/telegraf/plugins/inputs/system.(*CPUStats).Gather(0xc82034a720, 0x7f7f7ff59a30, 0xc830957a00, 0x0, 0x0)\r\nMay 12 12:44:20 psql02a telegraf[848]: /home/ubuntu/telegraf-build/src/github.com/influxdata/telegraf/plugins/inputs/system/cpu.go:44 +0x8d\r\nMay 12 12:44:20 psql02a telegraf[848]: github.com/influxdata/telegraf/agent.(*Agent).gatherParallel.func1(0xc8309923e0, 0xc820204ba0, 0xc820028090, 0x0, 0xc82034a780)\r\nMay 12 12:44:20 psql02a telegraf[848]: /home/ubuntu/telegraf-build/src/github.com/influxdata/telegraf/agent/agent.go:139 +0x42e\r\nMay 12 12:44:20 psql02a telegraf[848]: created by github.com/influxdata/telegraf/agent.(*Agent).gatherParallel\r\nMay 12 12:44:20 psql02a telegraf[848]: /home/ubuntu/telegraf-build/src/github.com/influxdata/telegraf/agent/agent.go:143 +0x442\r\nMay 12 12:44:20 psql02a telegraf[848]: goroutine 1 [semacquire]:\r\nMay 12 12:44:20 psql02a telegraf[848]: sync.runtime_Semacquire(0xc8309923ec)\r\nMay 12 12:44:20 psql02a telegraf[848]: /usr/local/go/src/runtime/sema.go:47 +0x26\r\nMay 12 12:44:20 psql02a telegraf[848]: sync.(*WaitGroup).Wait(0xc8309923e0)\r\nMay 12 12:44:20 psql02a telegraf[848]: /usr/local/go/src/sync/waitgroup.go:127 +0xb4\r\nMay 12 12:44:20 psql02a telegraf[848]: github.com/influxdata/telegraf/agent.(*Agent).gatherParallel(0xc820028090, 0xc820204ba0, 0x0, 0x0)\r\nMay 12 12:44:20 psql02a telegraf[848]: /home/ubuntu/telegraf-build/src/github.com/influxdata/telegraf/agent/agent.go:150 +0x145\r\nMay 12 12:44:20 psql02a telegraf[848]: github.com/influxdata/telegraf/agent.(*Agent).Run(0xc820028090, 0xc820204900, 0x0, 0x0)\r\nMay 12 12:44:20 psql02a telegraf[848]: /home/ubuntu/telegraf-build/src/github.com/influxdata/telegraf/agent/agent.go:378 +0xa7e\r\nMay 12 12:44:20 psql02a telegraf[848]: main.main()\r\nMay 12 12:44:20 psql02a telegraf[848]: /home/ubuntu/telegraf-build/src/github.com/influxdata/telegraf/cmd/t\r\nMay 12 12:44:20 psql02a telegraf[848]: 2016/05/12 12:44:20 PLEASE REPORT THIS PANIC ON GITHUB with stack trace, configuration, and OS information: https://github.com/influxdata/telegraf/issues/new\r\nMay 12 12:44:20 psql02a telegraf[848]: 2016/05/12 12:44:20 Error in input [diskio]: error getting disk io info: open /proc/diskstats: too many open files\r\nMay 12 12:44:20 psql02a telegraf[848]: 2016/05/12 12:44:20 Error in input [processes]: open /proc: too many open files\r\nMay 12 12:44:20 psql02a telegraf[848]: 2016/05/12 12:44:20 Error in input [system]: open /proc/loadavg: too many open files\r\nMay 12 12:44:20 psql02a telegraf[848]: 2016/05/12 12:44:20 Error in input [kernel]: open /proc/stat: too many open files\r\nMay 12 12:44:20 psql02a telegraf[848]: 2016/05/12 12:44:20 Gathered metrics, (10s interval), from 10 inputs in 15.202445ms\r\n```"}}