Skip to content

Commit

Permalink
[stanza/input/windows]: fix remote session leak while resubscribing (#…
Browse files Browse the repository at this point in the history
…35696)

Stop the remote session before starting a new one while resubscribing.

Closes
#35577
  • Loading branch information
VihasMakwana authored Oct 14, 2024
1 parent 5221a7a commit 0a6bb8a
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
27 changes: 27 additions & 0 deletions .chloggen/stanza-windows-remote-session-leak.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Use this changelog template to create an entry for release notes.

# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
change_type: bug_fix

# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver)
component: stanza/input/windows

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Close remote session while resubscribing

# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists.
issues: [35577]

# (Optional) One or more lines of additional information to render under the primary note.
# These lines will be padded with 2 spaces and then inserted directly into the document.
# Use pipe (|) for multiline entries.
subtext:

# If your change doesn't affect end users or the exported elements of any package,
# you should instead start your pull request title with [chore] or use the "Skip Changelog" label.
# Optional: The change log or logs in which this entry should be included.
# e.g. '[user]' or '[user, api]'
# Include 'user' if the change is relevant to end users.
# Include 'api' if there is a change to a library API.
# Default: '[user]'
change_logs: []
3 changes: 3 additions & 0 deletions pkg/stanza/operator/input/windows/input.go
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,9 @@ func (i *Input) read(ctx context.Context) {
i.Logger().Error("Failed to close remote subscription", zap.Error(closeErr))
return
}
if err := i.stopRemoteSession(); err != nil {
i.Logger().Error("Failed to close remote session", zap.Error(err))
}
i.Logger().Info("Resubscribing, creating remote subscription")
i.subscription = NewRemoteSubscription(i.remote.Server)
if err := i.startRemoteSession(); err != nil {
Expand Down

0 comments on commit 0a6bb8a

Please sign in to comment.