You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We use os/exec.Cmd.Wait to wait for a process to exit and report on that. Before attempting a kill (in response to a FS event), in order to prevent unnecessary log errors, Wago's Cmd.Kill() checks exec.Cmd fields to see if the process is alive. Because Wait() and Kill() must occur in concurrent goroutines, a number of inherent race conditions exist.
These race conditions are harmless. The objective is to ensure a command is killed as quickly as possible in response to an event with the least number of extraneous warnings — and this works most of the time. In the rare worst case scenario, a process exits after the kill conditional
This could probably be resolved by rewriting os/exec to use channels instead fields for conveying process information. However, it should be noted that a race condition will always exist at the OS level. A process could exit in the middle of the Wago code to kill that command.
Please do test Wago with -race, just be aware of this known race condition.
The text was updated successfully, but these errors were encountered:
Summary
A known, harmless, race condition exists between these two functions:
Details
We use os/exec.Cmd.Wait to wait for a process to exit and report on that. Before attempting a kill (in response to a FS event), in order to prevent unnecessary log errors, Wago's Cmd.Kill() checks exec.Cmd fields to see if the process is alive. Because Wait() and Kill() must occur in concurrent goroutines, a number of inherent race conditions exist.
These race conditions are harmless. The objective is to ensure a command is killed as quickly as possible in response to an event with the least number of extraneous warnings — and this works most of the time. In the rare worst case scenario, a process exits after the kill conditional
but before the kill itself
In this case, an extraneous error is printed.
This could probably be resolved by rewriting os/exec to use channels instead fields for conveying process information. However, it should be noted that a race condition will always exist at the OS level. A process could exit in the middle of the Wago code to kill that command.
Please do test Wago with -race, just be aware of this known race condition.
The text was updated successfully, but these errors were encountered: