File tree Expand file tree Collapse file tree 2 files changed +10
-0
lines changed
Expand file tree Collapse file tree 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]
3636
3737*Filebeat*
3838
39+ - Fix goroutine leak caused on initialization failures of log input. {pull}12125[12125]
3940- Fix memory leak in Filebeat pipeline acker. {pull}12063[12063]
4041
4142*Heartbeat*
Original file line number Diff line number Diff line change @@ -76,6 +76,12 @@ func NewInput(
7676 outlet channel.Connector ,
7777 context input.Context ,
7878) (input.Input , error ) {
79+ cleanupNeeded := true
80+ cleanupIfNeeded := func (f func () error ) {
81+ if cleanupNeeded {
82+ f ()
83+ }
84+ }
7985
8086 // Note: underlying output.
8187 // The input and harvester do have different requirements
@@ -87,11 +93,13 @@ func NewInput(
8793 if err != nil {
8894 return nil , err
8995 }
96+ defer cleanupIfNeeded (out .Close )
9097
9198 // stateOut will only be unblocked if the beat is shut down.
9299 // otherwise it can block on a full publisher pipeline, so state updates
93100 // can be forwarded correctly to the registrar.
94101 stateOut := channel .CloseOnSignal (channel .SubOutlet (out ), context .BeatDone )
102+ defer cleanupIfNeeded (stateOut .Close )
95103
96104 meta := context .Meta
97105 if len (meta ) == 0 {
@@ -137,6 +145,7 @@ func NewInput(
137145
138146 logp .Info ("Configured paths: %v" , p .config .Paths )
139147
148+ cleanupNeeded = false
140149 return p , nil
141150}
142151
You can’t perform that action at this time.
0 commit comments