Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cover: Fix a race condition in how the server is started as part of a…
… call Before sending a message to the cover server, the `call` function checks if the server is running, starting it if it does not. However, there is no locking/atomicity between the check and the start. If there is a concurrent call, the server might be started in parallel by another process and the `start()` call would return `{error, {already_started, _}}`. This causes the function to fail with a `badmatch` exception. The code now accepts that the server is running after seeing the server as stopped and retrying the call. V2: Fix coding style by applying a suggested patch from Björn Gustavsson. V3: Fix incorrect matching of `start()` return value: the correct pattern in `{error, {already_started, _}}`, not `{already_started, _}`. Found by Dialyzer, reported by Björn Gustavsson. Co-authored-by: Björn Gustavsson <[email protected]>
- Loading branch information