File tree 2 files changed +10
-0
lines changed
2 files changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -44,6 +44,7 @@ https://github.com/elastic/beats/compare/v6.7.2...6.8[Check the HEAD diff]
44
44
45
45
- Fix goroutine leak happening when harvesters are dynamically stopped. {pull}11263[11263]
46
46
- Fix initialization of the TCP input logger. {pull}11605[11605]
47
+ - Fix goroutine leak caused on initialization failures of log input. {pull}12125[12125]
47
48
- Fix memory leak in Filebeat pipeline acker. {pull}12063[12063]
48
49
49
50
*Heartbeat*
Original file line number Diff line number Diff line change @@ -76,6 +76,12 @@ func NewInput(
76
76
outlet channel.Connector ,
77
77
context input.Context ,
78
78
) (input.Input , error ) {
79
+ cleanupNeeded := true
80
+ cleanupIfNeeded := func (f func () error ) {
81
+ if cleanupNeeded {
82
+ f ()
83
+ }
84
+ }
79
85
80
86
// Note: underlying output.
81
87
// The input and harvester do have different requirements
@@ -87,11 +93,13 @@ func NewInput(
87
93
if err != nil {
88
94
return nil , err
89
95
}
96
+ defer cleanupIfNeeded (out .Close )
90
97
91
98
// stateOut will only be unblocked if the beat is shut down.
92
99
// otherwise it can block on a full publisher pipeline, so state updates
93
100
// can be forwarded correctly to the registrar.
94
101
stateOut := channel .CloseOnSignal (channel .SubOutlet (out ), context .BeatDone )
102
+ defer cleanupIfNeeded (stateOut .Close )
95
103
96
104
meta := context .Meta
97
105
if len (meta ) == 0 {
@@ -137,6 +145,7 @@ func NewInput(
137
145
138
146
logp .Info ("Configured paths: %v" , p .config .Paths )
139
147
148
+ cleanupNeeded = false
140
149
return p , nil
141
150
}
142
151
You can’t perform that action at this time.
0 commit comments