(Bug Report) Shared WaitGroup in Exec plugin
Bug report
The exec plugin gather function is relying on an instance shared WaitGroup which causes the gather function to hang indefinitely when run concurrently. This does not affect the current code base since the agent waits for gather to finish before kicking off a new one. I stumbled upon this while addressing an in-house requirement for gathers to kick off regardless of whether or not the previous one has finished.
Submitted pull request 1464 to address the issue.
This does not affect the current code base since the agent waits for gather to finish before kicking off a new one
Then why is this an issue? Seems like a bug report for a bug that can't happen :-)
Just addressing unsafe code. The waitGroup belongs in the gather function not in the struct instance.
@allen13 why is the code unsafe?
@sparrc The wait group is unnecessarily sharing its state between Gather executions. Should a previous gather fail to close it's waitgroup, future Gathers will hang indefinitely. Creating a new waitGroup instance for each Gather guarantees isolation.