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 @@ -36,6 +36,7 @@ https://github.com/elastic/beats/compare/v7.0.0...7.0[Check the HEAD diff]
36
36
37
37
*Filebeat*
38
38
39
+ - Fix goroutine leak caused on initialization failures of log input. {pull}12125[12125]
39
40
- Fix memory leak in Filebeat pipeline acker. {pull}12063[12063]
40
41
41
42
*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