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

PHP-FPM could crash when timeout is configured #15175

Closed
PierreF opened this issue Apr 17, 2024 · 2 comments · Fixed by #15176
Closed

PHP-FPM could crash when timeout is configured #15175

PierreF opened this issue Apr 17, 2024 · 2 comments · Fixed by #15176
Assignees
Labels
bug unexpected problem or unintended behavior

Comments

@PierreF
Copy link
Contributor

PierreF commented Apr 17, 2024

Relevant telegraf.conf

[[inputs.phpfpm]]
  urls = ["fcgi://127.0.0.1:9008/status"]
  timeout = "5s"

Logs from Telegraf

$ ./telegraf -test -config telegraf.conf 
2024-04-17T09:23:12Z I! Loading config: telegraf.conf
2024-04-17T09:23:12Z I! Starting Telegraf unknown brought to you by InfluxData the makers of InfluxDB
2024-04-17T09:23:12Z I! Available plugins: 234 inputs, 9 aggregators, 32 processors, 25 parsers, 60 outputs, 5 secret-stores
2024-04-17T09:23:12Z I! Loaded inputs: phpfpm
2024-04-17T09:23:12Z I! Loaded aggregators: 
2024-04-17T09:23:12Z I! Loaded processors: 
2024-04-17T09:23:12Z I! Loaded secretstores: 
2024-04-17T09:23:12Z W! Outputs are not used in testing mode!
2024-04-17T09:23:12Z I! Tags enabled: host=MBP-de-pierre
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x38 pc=0x1053632f4]

goroutine 116 [running]:
github.com/influxdata/telegraf/plugins/inputs/phpfpm.newFcgiClient(0x12a05f200, {0x14001bc23c8?, 0x9?}, {0x14000de6708?, 0x0?, 0x0?})
        /Users/pierref/dev/telegraf/plugins/inputs/phpfpm/fcgi_client.go:36 +0x1f4
github.com/influxdata/telegraf/plugins/inputs/phpfpm.(*phpfpm).gatherServer(0x14000edaa00, {0x14001bc23c1, 0x1c}, {0x10b7c8d40, 0x14000ee62a0})
        /Users/pierref/dev/telegraf/plugins/inputs/phpfpm/phpfpm.go:162 +0x24c
github.com/influxdata/telegraf/plugins/inputs/phpfpm.(*phpfpm).Gather.func1({0x14001bc23c1?, 0x0?})
        /Users/pierref/dev/telegraf/plugins/inputs/phpfpm/phpfpm.go:129 +0x70
created by github.com/influxdata/telegraf/plugins/inputs/phpfpm.(*phpfpm).Gather in goroutine 115
        /Users/pierref/dev/telegraf/plugins/inputs/phpfpm/phpfpm.go:127 +0x68

System info

Telegraf master, MacOS 14.4

Docker

No response

Steps to reproduce

  1. Do NOT run php-fpm, have nothing listening on port 9008
  2. Run Telegraf --test

Expected behavior

Don't crash :)

Actual behavior

Crash

Additional info

🤦 I've caused this issue in #15036 because I've never tested with no php-fpm running.

I'll submit a PR to fix in the next hours.

@PierreF PierreF added the bug unexpected problem or unintended behavior label Apr 17, 2024
@srebhan srebhan self-assigned this Apr 17, 2024
@srebhan
Copy link
Member

srebhan commented Apr 17, 2024

@PierreF please test the binary in PR #15179, available as soon as CI finished the tests, and let me know if this fixes the issue!

@PierreF
Copy link
Contributor Author

PierreF commented Apr 17, 2024

I've tested and it works with both #15179 and #15176 (before my first push force):

$ ./telegraf -test -config ../telegraf.conf
2024-04-17T13:30:50Z I! Loading config: ../telegraf.conf
2024-04-17T13:30:50Z I! Starting Telegraf 1.31.0-35085cc3 brought to you by InfluxData the makers of InfluxDB
2024-04-17T13:30:50Z I! Available plugins: 234 inputs, 9 aggregators, 32 processors, 25 parsers, 60 outputs, 5 secret-stores
2024-04-17T13:30:50Z I! Loaded inputs: phpfpm
2024-04-17T13:30:50Z I! Loaded aggregators:
2024-04-17T13:30:50Z I! Loaded processors:
2024-04-17T13:30:50Z I! Loaded secretstores:
2024-04-17T13:30:50Z W! Outputs are not used in testing mode!
2024-04-17T13:30:50Z I! Tags enabled: host=MBP-de-pierre
2024-04-17T13:30:50Z E! [inputs.phpfpm] Error in plugin: dial tcp 127.0.0.1:9008: connect: connection refused
2024-04-17T13:30:50Z E! [telegraf] Error running agent: input plugins recorded 1 errors

(Or 2024-04-17T13:30:27Z I! Starting Telegraf 1.31.0-1a584ffe brought to you by InfluxData the makers of InfluxDB)

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
Projects
None yet
2 participants