New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Data race in ProcessTree #3872
Comments
Thanks @subkin13. It really seems to be the case. Perhaps a mutex control only for the |
@geyslan Not so familiar with this code i'm afraid. @AlonZivony Would be more relevant here. |
@geyslan can you elaborate on the issue here? |
The goroutine triggered by tracee/pkg/proctree/proctree_procfs.go Lines 51 to 59 in 39fc6cc
If so, what @NDStrahilevitz says about lazy initialization makes sense and I put on top of that we should not overwrite the |
But does it cause an error? |
Agree. @subkin13 could you provide an output showing the error? Please include steps to reproduce. |
I just ran it with -race and it found it |
Hmm so I guess we would like to solve it just so it won't be considered a "race", but I don't think we really have an issue here. |
how about initializing procfsOnce in NewProcessTree? procTree := &ProcessTree{
processes: processes,
threads: threads,
**procfsOnce: new(sync.Once),**
ctx: ctx,
mutex: &sync.RWMutex{},
} |
That's the most sensible solution imo. Ditto for the channel. |
LGTM :) |
Could be a write and read to pt.procfsOnce.
Solution: move
if pt.procfsOnce == nil {
beforeif pt.procfsChan == nil {
The text was updated successfully, but these errors were encountered: