Repository navigation
fix(inputs.opcua): Disable auto-reconnect to fix session flood - #18813
Merged
srebhan merged 2 commits intoApr 29, 2026
Merged
Conversation
The polling reader has no subscriptions to preserve across reconnects, so gopcua's background reconnect loop only races with Telegraf's own connect/disconnect cycle. On server restart this dual-ownership floods the server with sessions and triggers BadTooManySessions. Disable the library's auto-reconnect for the polling input so Telegraf is the sole owner of reconnection. The listener plugin still uses subscriptions and is left untouched.
Merge TestGenerateClientOptsDisableAutoReconnect and TestGenerateClientOptsWithLocales into a single table-driven TestGenerateClientOptsExtras. Both shared the same "base + variant + len(base)+1" shape, so the table is the natural fit.
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 |
srebhan
pushed a commit
that referenced
this pull request
May 11, 2026
(cherry picked from commit 7ff59b8)
Stellar-roc
pushed a commit
to srp-devops/telegraf
that referenced
this pull request
Jun 9, 2026
…pc listener support as well (influxdata#18813)
1 of 2 tasks
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
inputs.opcuafloods the server with sessions on outage, hittingBadTooManySessions. Reported in #18787. User logs over 2 min after a server restart: 6,410CreateSessionRequest/ 6,788OpenSecureChannelRequest/ 1CloseSessionRequest. PeakCreateSessionrate is 75-114/sec; Telegraf's own connect log fires only 1-4/sec, so the bulk isn't coming from Telegraf's reconnect path.Source of the problem
Dual-ownership of reconnect between gopcua and Telegraf:
AutoReconnect = true. Each client runs a background monitor that, on channel break, loopscreateSecureChannel->restoreSession->recreateSessionwith no backoff between failures. When the server is overloaded by N parallel clients, intermediate steps fail, leaving orphan sessions.reconnect_error_threshold/forceReconnect/ explicitDisconnect+Connect, and creates a freshopcua.Client(and another monitor goroutine) each time.session_timeoutclears them.Patched binary has been tested against Codesys reproducer over two server restarts (comment).
CreateSessionRequestOpenSecureChannelRequestCloseSessionRequestBadTooManySessionsChecklist
Related issues
resolves #18787