Skip to content
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

cover: Fix a race condition in how the server is started as part of a call #9124

Open
wants to merge 1 commit into
base: maint
Choose a base branch
from

Conversation

dumbbell
Copy link
Contributor

Why

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 {already_started, _}. This causes the function to fail with the badmatch exception.

How

The code now accepts that the server is running after seeing the server as stopped and retrying the call.

… call

[Why]
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
`{already_started, _}`. This causes the function to fail with the
`badmatch` exception.

[How]
The code now accepts that the server is running after seeing the server
as stopped and retrying the call.
Copy link
Contributor

github-actions bot commented Nov 27, 2024

CT Test Results

  2 files   22 suites   6m 6s ⏱️
223 tests 220 ✅ 3 💤 0 ❌
249 runs  246 ✅ 3 💤 0 ❌

Results for commit 9587c7a.

♻️ This comment has been updated with latest results.

To speed up review, make sure that you have read Contributing to Erlang/OTP and that all checks pass.

See the TESTING and DEVELOPMENT HowTo guides for details about how to run test locally.

Artifacts

// Erlang/OTP Github Action Bot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant