tracee icon indicating copy to clipboard operation
tracee copied to clipboard

Bug: Sync issues between Tracee.Run() return and its goroutines finish

Open AlonZivony opened this issue 3 years ago • 8 comments

Currently, when tracee-ebpf receive the exit signal it finishes the Tracee.Run() function and return to main. In main, the printer.Close() method is called which disable future writing to the printer.

However, the events pipeline isn't necessary closed when the printer is closed. This might lead to events loss from the output, and sync problem between the printer stats and the actual printed values.

Other similar issues might happen with other goroutines of the function.

AlonZivony avatar Jan 23 '22 10:01 AlonZivony

Probably the solution to this issue will be to wait for all goroutines of Tracee.Run() to finish before exiting.

AlonZivony avatar Jan 23 '22 10:01 AlonZivony

We did something similar in #874.

AsafEitani avatar Jan 24 '22 10:01 AsafEitani

I am not sure if I have the time to take this in. If someone else think he can do it he can assign himself.

AlonZivony avatar Jan 24 '22 11:01 AlonZivony

is this relevant?

mtcherni95 avatar Apr 01 '22 11:04 mtcherni95

@NDStrahilevitz feel free to close this if you think there is nothing to be done.

rafaeldtinoco avatar Jun 23 '22 12:06 rafaeldtinoco

@NDStrahilevitz I ping you on it again

AlonZivony avatar Sep 19 '22 09:09 AlonZivony

Isn't this a duplicate of https://github.com/aquasecurity/tracee/issues/2171 ?

rafaeldtinoco avatar Sep 19 '22 14:09 rafaeldtinoco

Not quite but it makes sense to solve those two together

AsafEitani avatar Sep 20 '22 08:09 AsafEitani

I'm tackling https://github.com/aquasecurity/tracee/pull/2688 and facing race issues, one solution is being to change Tracee.running bool flag to atomic.Bool.

geyslan avatar Feb 20 '23 16:02 geyslan