Skip to content

fix: PLT-796: Prevent deadlocks with batch updates #7752

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

Merged
merged 2 commits into from
Jun 12, 2025

Conversation

triklozoid
Copy link
Contributor

@triklozoid triklozoid commented Jun 12, 2025

When multiple users are simultaneously working on projects with a large number of tasks, PostgreSQL deadlocks were occurring during massive tasks update operations. These deadlocks happen when the _rearrange_overlap_cohort() method tries to update thousands of task records in a single database
transaction while other users are also modifying tasks in the same project.

  • Split large UPDATE operations into batches (500 records)
  • Added retry logic with exponential backoff (up to 3 attempts)
  • Updated _rearrange_overlap_cohort() to use batch updates

Copy link

netlify bot commented Jun 12, 2025

Deploy Preview for label-studio-docs-new-theme canceled.

Name Link
🔨 Latest commit 1466beb
🔍 Latest deploy log https://app.netlify.com/projects/label-studio-docs-new-theme/deploys/684b05878751530008871abc

Copy link

netlify bot commented Jun 12, 2025

Deploy Preview for heartex-docs canceled.

Name Link
🔨 Latest commit 1466beb
🔍 Latest deploy log https://app.netlify.com/projects/heartex-docs/deploys/684b0586a3d39d0008321c97

Copy link

netlify bot commented Jun 12, 2025

Deploy Preview for label-studio-storybook ready!

Name Link
🔨 Latest commit 1466beb
🔍 Latest deploy log https://app.netlify.com/projects/label-studio-storybook/deploys/684b058642851d0008d781df
😎 Deploy Preview https://deploy-preview-7752--label-studio-storybook.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@github-actions github-actions bot added the fix label Jun 12, 2025
Copy link

netlify bot commented Jun 12, 2025

Deploy Preview for label-studio-playground ready!

Name Link
🔨 Latest commit 1466beb
🔍 Latest deploy log https://app.netlify.com/projects/label-studio-playground/deploys/684b058642851d0008d781e1
😎 Deploy Preview https://deploy-preview-7752--label-studio-playground.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Copy link

codecov bot commented Jun 12, 2025

Codecov Report

Attention: Patch coverage is 96.42857% with 1 line in your changes missing coverage. Please review.

Project coverage is 78.85%. Comparing base (44b34f5) to head (450fbe0).
Report is 9 commits behind head on develop.

✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
label_studio/projects/models.py 96.42% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #7752      +/-   ##
===========================================
+ Coverage    78.83%   78.85%   +0.02%     
===========================================
  Files          205      205              
  Lines        16336    16358      +22     
===========================================
+ Hits         12878    12899      +21     
- Misses        3458     3459       +1     
Flag Coverage Δ
pytests 78.85% <96.42%> (+0.02%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@triklozoid triklozoid requested a review from jombooth June 12, 2025 14:08
@robot-ci-heartex robot-ci-heartex merged commit 2436804 into develop Jun 12, 2025
51 checks passed
@robot-ci-heartex robot-ci-heartex deleted the fb-PLT-796 branch June 12, 2025 19:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants