-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
fix(http_listener_v2): fix panic on close #10132
fix(http_listener_v2): fix panic on close #10132
Conversation
a98c553
to
7c0e472
Compare
Thanks for tackling this issue so quickly. This proposed changes would cause the plugin to continue running in the background reporting a failure without ever recovering, it seems it would be better to add an |
Can you elaborate on this a bit more?
I believe the problem that needs fixing here is handling closed channel in
accumulator when a metric that's processed is send to it without a check,
causing a panic.
…On Thu, Nov 18, 2021, 23:16 Sebastian Spaink ***@***.***> wrote:
Thanks for tackling this issue so quickly. This proposed changes would
cause the plugin to continue running in the background reporting a failure
without ever recovering, it seems it would be better to add an Init()
function and check for connection failure and exit Telegraf early. Would
that work for you?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#10132 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AQPQ3GS32DKYI2IBKJBIIILUMV3J7ANCNFSM5IKVGJAQ>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
|
7c0e472
to
0329006
Compare
@sspaink I've added |
Hi @sspaink 👋 Can we move forward with this PR? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pmalek-sumo sorry for taking a while to get back to your pr, after looking it over again I do think I understand your solution better. So the plugin is serving HTTP requests in a goroutine in Start, and you've added a close
channel to notify the serveWrite
method when a failure occurs to let it know Telegraf is shutting down. This seems like the best approach, I do have two comments I would like you to look at. My earlier comment to move some of the code to an Init()
was misleading, but my intention was to try to fail earlier but now I realize server.Serve(h.listener)
can fail at any point not just at startup.
0329006
to
2b19e36
Compare
2b19e36
to
44dbaf7
Compare
🥳 This pull request decreases the Telegraf binary size by -1.37 % for linux amd64 (new size: 131.5 MB, nightly size 133.3 MB) 📦 Looks like new artifacts were built from this PR. Expand this list to get them here ! 🐯Artifact URLs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for fixing this, looks good to me! Marking for final review.
(cherry picked from commit 1b95720)
* origin/master: (133 commits) chore: restart service if it is already running and upgraded via RPM (influxdata#9970) feat: update etc/telegraf.conf and etc/telegraf_windows.conf (influxdata#10237) fix: Handle duplicate registration of protocol-buffer files gracefully. (influxdata#10188) fix(http_listener_v2): fix panic on close (influxdata#10132) feat: add Vault input plugin (influxdata#10198) feat: support aws managed service for prometheus (influxdata#10202) fix: Make telegraf compile on Windows with golang 1.16.2 (influxdata#10246) Update changelog feat: Modbus add per-request tags (influxdata#10231) fix: Implement NaN and inf handling for elasticsearch output (influxdata#10196) feat: add nomad input plugin (influxdata#10106) fix: Print loaded plugins and deprecations for once and test (influxdata#10205) fix: eliminate MIB dependency for ifname processor (influxdata#10214) feat: Optimize locking for SNMP MIBs loading. (influxdata#10206) feat: Add SMART plugin concurrency configuration option, nvme-cli v1.14+ support and lint fixes. (influxdata#10150) feat: update configs (influxdata#10236) fix(inputs/kube_inventory): set TLS server name config properly (influxdata#9975) fix: Sudden close of Telegraf caused by OPC UA input plugin (influxdata#10230) fix: bump github.com/eclipse/paho.mqtt.golang from 1.3.0 to 1.3.5 (influxdata#9913) fix: json_v2 parser timestamp setting (influxdata#10221) fix: ensure graylog spec fields not prefixed with '_' (influxdata#10209) docs: remove duplicate links in CONTRIBUTING.md (influxdata#10218) fix: pool detection and metrics gathering for ZFS >= 2.1.x (influxdata#10099) fix: parallelism fix for ifname processor (influxdata#10007) chore: Forbids "log" package only for aggregators, inputs, outputs, parsers and processors (influxdata#10191) docs: address documentation gap when running telegraf in k8s (influxdata#10215) feat: update etc/telegraf.conf and etc/telegraf_windows.conf (influxdata#10211) fix: mqtt topic extracting no longer requires all three fields (influxdata#10208) fix: windows service - graceful shutdown of telegraf (influxdata#9616) feat: update etc/telegraf.conf and etc/telegraf_windows.conf (influxdata#10201) feat: Modbus support multiple slaves (gateway feature) (influxdata#9279) fix: Revert unintented corruption of the Makefile from influxdata#10200. (influxdata#10203) chore: remove triggering update-config bot in CI (influxdata#10195) Update changelog feat: Implement deprecation infrastructure (influxdata#10200) fix: extra lock on init for safety (influxdata#10199) fix: resolve influxdata#10027 (influxdata#10112) fix: register bigquery to output plugins influxdata#10177 (influxdata#10178) fix: sysstat use unique temp file vs hard-coded (influxdata#10165) refactor: snmp to use gosmi (influxdata#9518) ...
Fixes: #10125