Repository navigation
fix(inputs.tail): Prevent panic when closing tailers under load - #19093
Merged
srebhan merged 1 commit intoJun 18, 2026
Merged
Conversation
With multiple files, all tailers share a single semaphore that is sized to max_undelivered_lines and kept in lockstep with the tracking accumulator's delivery channel: a tailer must acquire a slot before adding a metric, and a slot is freed only when a metric is delivered. When a tailer closed while blocked adding a line, the receiver released a semaphore slot without a matching delivery. With other tailers still running, that freed slot let one of them add beyond the budget and overflow the delivery channel, which panics with "channel is full" and crashes the agent before plugin state (read offsets) is persisted. Drop the line on close without releasing the semaphore. The receiver still exits via the dying branch and keeps draining the tailer so it can stop, so the close-time deadlock guarded against previously stays fixed. resolves influxdata#19073
skartikey
marked this pull request as draft
June 12, 2026 13:39
Contributor
|
Download PR build artifacts for linux_amd64.tar.gz, darwin_arm64.tar.gz, and windows_amd64.zip. 📦 Click here to get additional PR build artifactsArtifact URLs |
skartikey
marked this pull request as ready for review
June 16, 2026 09:30
skartikey
added a commit
that referenced
this pull request
Jun 29, 2026
(cherry picked from commit 2c1535d)
social4hyq
pushed a commit
to social4hyq/homebrew-core
that referenced
this pull request
Sep 20, 2026
telegraf 1.39.1 Created-by: HarmonybrewBot Commit-by: HarmonybrewBot Merged-by: HarmonybrewBot Description: Created by `brew bump` --- Created with `brew bump-formula-pr`.<details> <summary>release notes</summary> <pre>## v1.39.1 [2026-06-29] ### Bugfixes - [#19077](influxdata/telegraf#19077) `build` Create tarballs correctly - [#19070](influxdata/telegraf#19070) `inputs.opcua` Close session on stop to prevent reload leak - [#19159](influxdata/telegraf#19159) `inputs.opcua` Skip client certificate on unsecured None channel - [#19076](influxdata/telegraf#19076) `inputs.openweathermap` Remove calls to deprecated v2.5 group API - [#19167](influxdata/telegraf#19167) `inputs.smartctl` Parse stdout only to avoid corrupting JSON - [#19093](influxdata/telegraf#19093) `inputs.tail` Prevent panic when closing tailers under load - [#19067](influxdata/telegraf#19067) `inputs.temp` Use non-blocking read for hwmon temperatures - [#19126](influxdata/telegraf#19126) `inputs.vsphere` Fix missing vSAN overall_health metric - [#19074](influxdata/telegraf#19074) `processors.parser` Handle metrics without inner timestamp correctly - [#19129](influxdata/telegraf#19129) `migrations` Add migration for inputs.aerospike - [#19121](influxdata/telegraf#19121) `migrations` Add migration for inputs.kafka_consumer connection_strategy option - [#19122](influxdata/telegraf#19122) `migrations` Add migration for inputs.openstack server_diagnotics option - [#19133](influxdata/telegraf#19133) `migrations` Add migration for inputs.openweathermap query_style option - [#19117](influxdata/telegraf#19117) `migrations` Add migration for inputs.tail from_beginning option - [#19128](influxdata/telegraf#19128) `migrations` Add migration for outputs.amon ### Dependency Updates - [#19138](influxdata/telegraf#19138) `deps` Bump actions/checkout from 6 to 7 - [#19065](influxdata/telegraf#19065) `deps` Bump cloud.google.com/go/storage from 1.62.2 to 1.62.3 - [#19058](influxdata/telegraf#19058) `deps` Bump github.com/Azure/azure-sdk-for-go/sdk/azcore from 1.21.1 to 1.22.0 - [#19106](influxdata/telegraf#19106) `deps` Bump github.com/Azure/azure-sdk-for-go/sdk/azidentity from 1.13.1 to 1.14.0 - [#19059](influxdata/telegraf#19059) `deps` Bump github.com/IBM/sarama from 1.50.1 to 1.50.2 - [#19110](influxdata/telegraf#19110) `deps` Bump github.com/IBM/sarama from 1.50.2 to 1.50.3 - [#19102](influxdata/telegraf#19102) `deps` Bump github.com/SAP/go-hdb from 1.16.11 to 1.16.12 - [#19057](influxdata/telegraf#19057) `deps` Bump github.com/aws/smithy-go from 1.27.0 to 1.27.2 - [#19060](influxdata/telegraf#19060) `deps` Bump github.com/gopacket/gopacket from 1.6.0 to 1.6.1 - [#19142](influxdata/telegraf#19142) `deps` Bump github.com/gopcua/opcua from 0.8.0 to 0.9.0 - [#19064](influxdata/telegraf#19064) `deps` Bump github.com/jedib0t/go-pretty/v6 from 6.7.10 to 6.8.0 - [#19108](influxdata/telegraf#19108) `deps` Bump github.com/jedib0t/go-pretty/v6 from 6.8.0 to 6.8.1 - [#19150](influxdata/telegraf#19150) `deps` Bump github.com/moby/moby/api from 1.54.2 to 1.55.0 - [#19149](influxdata/telegraf#19149) `deps` Bump github.com/moby/moby/client from 0.4.1 to 0.5.0 - [#19053](influxdata/telegraf#19053) `deps` Bump github.com/pion/dtls/v3 from 3.1.3 to 3.1.4 - [#19115](influxdata/telegraf#19115) `deps` Bump github.com/prometheus-community/pro-bing from 0.8.0 to 0.9.0 - [#19147](influxdata/telegraf#19147) `deps` Bump github.com/prometheus/common from 0.68.1 to 0.69.0 - [#19141](influxdata/telegraf#19141) `deps` Bump github.com/rabbitmq/amqp091-go from 1.11.0 to 1.12.0 - [#19170](influxdata/telegraf#19170) `deps` Bump github.com/rclone/rclone from 1.69.3 to 1.74.1-0.20260628215305-6bbc28cf02dc - [#19109](influxdata/telegraf#19109) `deps` Bump github.com/redis/go-redis/v9 from 9.20.0 to 9.20.1 - [#19148](influxdata/telegraf#19148) `deps` Bump github.com/redis/go-redis/v9 from 9.20.1 to 9.21.0 - [#19152](influxdata/telegraf#19152) `deps` Bump github.com/testcontainers/testcontainers-go/modules/azure from 0.42.0 to 0.43.0 - [#19143](influxdata/telegraf#19143) `deps` Bump github.com/testcontainers/testcontainers-go/modules/kafka from 0.42.0 to 0.43.0 - [#19144](influxdata/telegraf#19144) `deps` Bump github.com/testcontainers/testcontainers-go/modules/vault from 0.42.0 to 0.43.0 - [#19111](influxdata/telegraf#19111) `deps` Bump go.opentelemetry.io/collector/pdata from 1.59.0 to 1.60.0 - [#19054](influxdata/telegraf#19054) `deps` Bump go.step.sm/crypto from 0.81.1 to 0.82.0 - [#19104](influxdata/telegraf#19104) `deps` Bump go.step.sm/crypto from 0.82.0 to 0.83.0 - [#19061](influxdata/telegraf#19061) `deps` Bump golang.org/x/crypto from 0.52.0 to 0.53.0 - [#19055](influxdata/telegraf#19055) `deps` Bump golang.org/x/mod from 0.36.0 to 0.37.0 - [#19056](influxdata/telegraf#19056) `deps` Bump golang.org/x/sync from 0.20.0 to 0.21.0 - [#19066](influxdata/telegraf#19066) `deps` Bump golang.org/x/sys from 0.45.0 to 0.46.0 - [#19063](influxdata/telegraf#19063) `deps` Bump golang.org/x/term from 0.43.0 to 0.44.0 - [#19062](influxdata/telegraf#19062) `deps` Bump golang.org/x/text from 0.37.0 to 0.38.0 - [#19107](influxdata/telegraf#19107) `deps` Bump golang.org/x/tools from 0.45.0 to 0.46.0 - [#19101](influxdata/telegraf#19101) `deps` Bump google.golang.org/api from 0.283.0 to 0.284.0 - [#19145](influxdata/telegraf#19145) `deps` Bump google.golang.org/api from 0.284.0 to 0.286.0 - [#19103](influxdata/telegraf#19103) `deps` Bump k8s.io/api from 0.36.1 to 0.36.2 - [#19113](influxdata/telegraf#19113) `deps` Bump k8s.io/client-go from 0.36.1 to 0.36.2 - [#19052](influxdata/telegraf#19052) `deps` Bump modernc.org/sqlite from 1.51.0 to 1.52.0 - [#19151](influxdata/telegraf#19151) `deps` Bump modernc.org/sqlite from 1.52.0 to 1.53.0 - [#19105](influxdata/telegraf#19105) `deps` Bump software.sslmate.com/src/go-pkcs12 from 0.7.1 to 0.7.2 - [#19139](influxdata/telegraf#19139) `deps` Bump super-linter/super-linter from 8.6.0 to 8.7.0 - [#19051](influxdata/telegraf#19051) `deps` Bump the aws-sdk-go-v2 group across 1 directory with 11 updates - [#19140](influxdata/telegraf#19140) `deps` Bump the aws-sdk-go-v2 group with 2 updates - [#19100](influxdata/telegraf#19100) `deps` Bump the aws-sdk-go-v2 group with 6 updates ### Packages Arch | Platform | Package | SHA256 ---| --- | --- | --- arm64 | CentOS | [telegraf-1.39.1-1.aarch64.rpm](https://dl.influxdata.com/telegraf/releases/telegraf-1.39.1-1.aarch64.rpm) | 0227b00b6295c326f07e3c8e5d463ec045c63526cf6c9cbc13a45dc837700063 armel | CentOS | [telegraf-1.39.1-1.armel.rpm](https://dl.influxdata.com/telegraf/releases/telegraf-1.39.1-1.armel.rpm) | 6712998ae341138c118eacdea1044964a9a29e8fb283c5e4b3bf7d99af5a6352 armv6hl | CentOS | [telegraf-1.39.1-1.armv6hl.rpm](https://dl.influxdata.com/telegraf/releases/telegraf-1.39.1-1.armv6hl.rpm) | 2d406f71c983f6639d7e5ead7b00b52466245624fccc37bfaa89603462c37a4d i386 | CentOS | [telegraf-1.39.1-1.i386.rpm](https://dl.influxdata.com/telegraf/releases/telegraf-1.39.1-1.i386.rpm) | 7d769ca55c362fc9b841d8a644fd3c129c732c6c2db7c8d556748fb4a137b269 unknown | CentOS | [telegraf-1.39.1-1.loongarch64.rpm](https://dl.influxdata.com/telegraf/releases/telegraf-1.39.1-1.loongarch64.rpm) | e9a9f8591286b41c6d61af28fd6ff8bd050a1b1bdd54b52cca6e862ee7eab2dc ppc64le | CentOS | [telegraf-1.39.1-1.ppc64le.rpm](https://dl.influxdata.com/telegraf/releases/telegraf-1.39.1-1.ppc64le.rpm) | 846a6480d333bb3dd0bdb11c6bbe674a839136e488cde7510dff978edf77a988 riscv64 | CentOS | [telegraf-1.39.1-1.riscv64.rpm](https://dl.influxdata.com/telegraf/releases/telegraf-1.39.1-1.riscv64.rpm) | 9653bb7adca7919c8b9b94d8f322c26c71635face57e12ed4a8276a78f0a2f11 s390x | CentOS | [telegraf-1.39.1-1.s390x.rpm](https://dl.influxdata.com/telegraf/releases/telegraf-1.39.1-1.s390x.rpm) | 5df8a1dd1ac77ea253cc2ca99ff1fbf6aed995da09362af3ae213fbbad5a4438 amd64 | CentOS | [telegraf-1.39.1-1.x86_64.rpm](https://dl.influxdata.com/telegraf/releases/telegraf-1.39.1-1.x86_64.rpm) | 8775538460f86e1ae86a47eb92a92932d1b8949c888d0171df4d8b0534145e73 amd64 | macOS | [telegraf-1.39.1_darwin_amd64.dmg](https://dl.influxdata.com/telegraf/releases/telegraf-1.39.1_darwin_amd64.dmg) | 3b61fcb0abac52d8f915ff900b2c504f2a99fd9dc58a2589f533d611f6d6ff4d amd64 | macOS | [telegraf-1.39.1_darwin_amd64.tar.gz](https://dl.influxdata.com/telegraf/releases/telegraf-1.39.1_darwin_amd64.tar.gz) | 653c8a4b5afe66b0a6223952853de9f4d9ad4387b62858248fcad1ff4021e060 arm64 | macOS | [telegraf-1.39.1_darwin_arm64.dmg](https://dl.influxdata.com/telegraf/releases/telegraf-1.39.1_darwin_arm64.dmg) | 7af3ca693daae87e4503a3c0 See merge request: Harmonybrew/homebrew-core!13084
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
All tailers share one semaphore (
t.sem) sized tomax_undelivered_lines, kept in lockstep with the tracking accumulator's delivery channel of the same size: a receiver must acquire a slot beforeAddTrackingMetricGroup, and a slot is freed only when the drain goroutine sees a delivery onDelivered(). This keeps the in-flight count at or below the delivery channel capacity.The
<-tailer.Dying()branch inreceiver(added in #15649 to avoid a close-time deadlock) released a semaphore slot without a corresponding delivery. With more than one tailer, another receiver that was blocked adding a line then took the freed slot and pushed the in-flight count past the budget. The next delivery overflowed the channel and hit thepanic("channel is full")guard in the tracking accumulator. A single-file setup cannot trigger it, which is why it only shows up on busy multi-file hosts.Fix
Drop the current line on close without releasing the semaphore. The receiver still exits through the dying branch and keeps draining
tailer.Linessotailer.Stop()can complete, so the deadlock #15649 fixed does not return. Data-loss behavior is unchanged: that branch already dropped the blocked line; it only additionally and incorrectly freed a budget slot.The
panicguard in the accumulator is left as is. It is an intentional programming-error signal; the defect was tail over-subscribing the budget.Checklist
Related issues
resolves #19073