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

fix(2079/deadlock): avoid deadlock by updating env individually #3339

Merged
merged 1 commit into from
Jan 30, 2024

Conversation

gagantrivedi
Copy link
Member

@gagantrivedi gagantrivedi commented Jan 29, 2024

Thanks for submitting a PR! Please check the boxes below:

  • I have run pre-commit to check linting
  • I have added information to docs/ if required so people know about the feature!
  • I have filled in the "Changes" section below?
  • I have filled in the "How did you test this code" section below?
  • I have used a Conventional Commit title for this Pull Request

Changes

As documented here the cause of the deadlock was this where clause .... where project_id=<>. This PR avoids that by updating the updated_at for every environment individually, i.e: ...where environment_id=<>

Note: the duplicate signals issue is not relevant any more because we exclude updated_at from historical tracking

How did you test this code?

I attempted to reproduce this on staging by updating segments for a project using wrk (10 threads, 10 connections), but I could not. However, based on reasoning, this should work.

Copy link

vercel bot commented Jan 29, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
docs ✅ Ready (Inspect) Visit Preview Jan 29, 2024 11:19am
flagsmith-frontend-preview ✅ Ready (Inspect) Visit Preview Jan 29, 2024 11:19am
flagsmith-frontend-staging ✅ Ready (Inspect) Visit Preview Jan 29, 2024 11:19am

@github-actions github-actions bot added the api Issue related to the REST API label Jan 29, 2024
@gagantrivedi gagantrivedi requested review from a team, khvn26 and matthewelwell and removed request for a team January 29, 2024 11:20
Copy link
Contributor

github-actions bot commented Jan 29, 2024

Uffizzi Preview deployment-45276 was deleted.

@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (84d912d) 95.95% compared to head (9322840) 50.85%.
Report is 1 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff             @@
##             main    #3339       +/-   ##
===========================================
- Coverage   95.95%   50.85%   -45.10%     
===========================================
  Files        1067     1001       -66     
  Lines       32673    29527     -3146     
===========================================
- Hits        31350    15015    -16335     
- Misses       1323    14512    +13189     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@matthewelwell matthewelwell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks fine but I'm keen to try and get a reproducible test if we can. As mentioned in slack, we should be able to do that by creating / deleting huge segments.

@gagantrivedi gagantrivedi added this pull request to the merge queue Jan 30, 2024
Merged via the queue into main with commit 85443a2 Jan 30, 2024
20 of 21 checks passed
@gagantrivedi gagantrivedi deleted the fix/2709/avoid-deadlock branch January 30, 2024 11:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api Issue related to the REST API
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants