Skip to content

Commit

Permalink
fix(proctree): possible sync.Once data race (#4307)
Browse files Browse the repository at this point in the history
  • Loading branch information
geyslan authored Sep 25, 2024
1 parent 795a95b commit 604c391
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 3 deletions.
1 change: 1 addition & 0 deletions pkg/proctree/proctree.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ func NewProcessTree(ctx context.Context, config ProcTreeConfig) (*ProcessTree, e
procTree := &ProcessTree{
processes: processes,
threads: threads,
procfsOnce: new(sync.Once),
ctx: ctx,
procfsQuery: config.ProcfsQuerying,
}
Expand Down
3 changes: 0 additions & 3 deletions pkg/proctree/proctree_procfs.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,6 @@ func (pt *ProcessTree) FeedFromProcFSAsync(givenPid int) {
pt.procfsChan = make(chan int, 1000)
pt.feedFromProcFSLoop()
}
if pt.procfsOnce == nil {
pt.procfsOnce = new(sync.Once)
}

// feed the loop without blocking (if the loop is busy, given pid won't be processed)
select {
Expand Down

0 comments on commit 604c391

Please sign in to comment.