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

phpfpm module crashes when fastcgi endpoint is down #1886

Closed
jeichorn opened this issue Oct 11, 2016 · 3 comments · Fixed by #1889 or #13495
Closed

phpfpm module crashes when fastcgi endpoint is down #1886

jeichorn opened this issue Oct 11, 2016 · 3 comments · Fixed by #1889 or #13495
Labels
bug unexpected problem or unintended behavior panic issue that results in panics from Telegraf
Milestone

Comments

@jeichorn
Copy link

Bug report

Using fcgi urls in phpfpm causes telegraf to crash when the endpoint doesnt' exist

Relevant telegraf.conf:

[phpfpm]
  urls = ["fcgi://127.0.0.1:48840/fpmstatus"]

System info:

Telegraf 1.0.1, Ubuntu 16.04
[Include Telegraf version, operating system name, and other relevant details]

Steps to reproduce:

Add in a bad fcgi config, launch telegraf

Expected behavior:

Not crashing

Actual behavior:

Crashing

Additional info:

panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xb code=0x1 addr=0x0 pc=0x5f0530]

goroutine 63 [running]:
panic(0x12ecf20, 0xc8200100c0)
        /usr/lib/go-1.6/src/runtime/panic.go:481 +0x3e6
github.com/influxdata/telegraf/plugins/inputs/phpfpm.(*conn).Request(0xc82060e090, 0xc8206080c0, 0xc8205b5c18, 0xa, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
        /build/src/github.com/influxdata/telegraf/plugins/inputs/phpfpm/fcgi_client.go:40 +0x750
github.com/influxdata/telegraf/plugins/inputs/phpfpm.(*phpfpm).gatherFcgi(0xc8200bfac0, 0xc82060e090, 0xc82021ebe8, 0x9, 0x7fd4ebce2840, 0xc82021e540, 0x0, 0x0)
        /build/src/github.com/influxdata/telegraf/plugins/inputs/phpfpm/phpfpm.go:163 +0x263
github.com/influxdata/telegraf/plugins/inputs/phpfpm.(*phpfpm).gatherServer(0xc8200bfac0, 0xc82021ebd1, 0x20, 0x7fd4ebce2840, 0xc82021e540, 0x0, 0x0)
        /build/src/github.com/influxdata/telegraf/plugins/inputs/phpfpm/phpfpm.go:150 +0x75e
github.com/influxdata/telegraf/plugins/inputs/phpfpm.(*phpfpm).Gather.func1(0xc82048bf30, 0xc82048bf40, 0xc8200bfac0, 0x7fd4ebce2840, 0xc82021e540, 0xc82021ebd1, 0x20)
        /build/src/github.com/influxdata/telegraf/plugins/inputs/phpfpm/phpfpm.go:89 +0x7b
created by github.com/influxdata/telegraf/plugins/inputs/phpfpm.(*phpfpm).Gather
        /build/src/github.com/influxdata/telegraf/plugins/inputs/phpfpm/phpfpm.go:90 +0x1d1
@sparrc sparrc added bug unexpected problem or unintended behavior panic issue that results in panics from Telegraf labels Oct 12, 2016
@sparrc sparrc added this to the 1.1.0 milestone Oct 12, 2016
sparrc added a commit that referenced this issue Oct 12, 2016
@odoucet
Copy link

odoucet commented Jun 26, 2023

There is a regression and this bug happens again : if FPM status page does not exist / is unreachable, telegraf 1.24.2 failed to launch :

panic: runtime error: index out of range [1] with length 1

goroutine 56 [running]:
github.com/influxdata/telegraf/plugins/inputs/phpfpm.(*phpfpm).gatherServer(0x0?, {0xc0003ee931, 0x1d}, {0x67147a0, 0xc000e09340})
        /go/src/github.com/influxdata/telegraf/plugins/inputs/phpfpm/phpfpm.go:120 +0x458
github.com/influxdata/telegraf/plugins/inputs/phpfpm.(*phpfpm).Gather.func1({0xc0003ee931?, 0x0?})
        /go/src/github.com/influxdata/telegraf/plugins/inputs/phpfpm/phpfpm.go:91 +0x7c
created by github.com/influxdata/telegraf/plugins/inputs/phpfpm.(*phpfpm).Gather
        /go/src/github.com/influxdata/telegraf/plugins/inputs/phpfpm/phpfpm.go:89 +0x1ed
# note here that port was forgotten
[[inputs.phpfpm]]
urls = [
      "fcgi://127.0.0.1/status",
    "fcgi://127.0.0.2/status",
    "fcgi://127.0.0.3/status",
    ]

powersj added a commit to powersj/telegraf that referenced this issue Jun 26, 2023
@powersj
Copy link
Contributor

powersj commented Jun 26, 2023

@odoucet - Please do not comment on closed issues it is unhelpful. Additionally, this is not a regression, you have not followed the readme or configuration. It says the following when using the fcgi protocol:

  ##   - fcgi: the URL must start with fcgi:// or cgi://, and port must be present, ie:

You have left that port out. As soon as I add it I instead get:

2023-06-26T13:21:56Z E! [inputs.phpfpm] Error in plugin: dial tcp 127.0.0.3:9999: connect: connection refused
2023-06-26T13:21:56Z E! [inputs.phpfpm] Error in plugin: dial tcp 127.0.0.2:9900: connect: connection refused
2023-06-26T13:21:56Z E! [inputs.phpfpm] Error in plugin: dial tcp 127.0.0.1:9001: connect: connection refused

@odoucet
Copy link

odoucet commented Jun 27, 2023

Thanks for https://github.com/influxdata/telegraf/pull/13495/files , it is so much more helpful to have a clear error message than a Go error :)

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
4 participants