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

tests: use semaphore instead of lock for Endpoint.running #8112

Merged
merged 1 commit into from
Jun 19, 2024

Conversation

jcsp
Copy link
Collaborator

@jcsp jcsp commented Jun 19, 2024

Problem

Ahem, let's try this again.

#8110 had a spooky failure in test_multi_attach where a call to Endpoint.stop() timed out waiting for a lock, even though we can see an earlier call completing and releasing the lock. I suspect something weird is going on with the way pytest runs tests across processes, or use of asyncio perhaps.

Anyway: the simplest fix is to just use a semaphore instead: if we don't lock we can't deadlock.

Summary of changes

  • Make Endpoint.running a semaphore, where we add a unit to its counter when starting the process and atomically decrement it when stopping.

Checklist before requesting a review

  • I have performed a self-review of my code.
  • If it is a core feature, I have added thorough tests.
  • Do we need to implement analytics? if so did you add the relevant metrics to the dashboard?
  • If this PR requires public announcement, mark it with /release-notes label and add several sentences in this section.

Checklist before merging

  • Do not forget to reformat commit message to not include the above checklist

@jcsp jcsp added a/test Area: related to testing a/tech_debt Area: related to tech debt labels Jun 19, 2024
@jcsp jcsp requested a review from bayandin June 19, 2024 14:03
Copy link

3228 tests run: 3111 passed, 0 failed, 117 skipped (full report)


Flaky tests (1)

Postgres 15

  • test_timeline_size_quota_on_startup: release

Code coverage* (full report)

  • functions: 32.4% (6848 of 21165 functions)
  • lines: 49.7% (53399 of 107360 lines)

* collected from Rust tests only


The comment gets automatically updated with the latest test results
8cc4c9d at 2024-06-19T15:46:27.823Z :recycle:

@jcsp jcsp marked this pull request as ready for review June 19, 2024 15:48
@jcsp jcsp enabled auto-merge (squash) June 19, 2024 15:48
@jcsp jcsp merged commit f0e2bb7 into main Jun 19, 2024
69 of 70 checks passed
@jcsp jcsp deleted the jcsp/tests-concurrent-ep-stop-mk2 branch June 19, 2024 16:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a/tech_debt Area: related to tech debt a/test Area: related to testing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants