Skip to content

fix: avoid deadlocking singleflighted reqs#3048

Draft
miparnisari wants to merge 2 commits intomainfrom
deadlock-singleflight
Draft

fix: avoid deadlocking singleflighted reqs#3048
miparnisari wants to merge 2 commits intomainfrom
deadlock-singleflight

Conversation

@miparnisari
Copy link
Copy Markdown
Contributor

@miparnisari miparnisari commented Apr 15, 2026

Description

Potential fix for #2788

image

TO DO: discuss with @josephschorr. I want to overhaul the singleflight code (specifically singleflight.go, optimized.go, and context.go).

  • move the code of optimized.go into singleflight.go
  • move CRDB's featureGroup into singleflight.go
image

Testing

docker-compose -f docker-compose.deadlock.yaml up -d
sh reproduce_deadlock.sh

reproduce_deadlock.sh
docker-compose.deadlock.yaml

References

@github-actions github-actions Bot added the area/datastore Affects the storage system label Apr 15, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 15, 2026

Codecov Report

❌ Patch coverage is 93.75000% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 75.57%. Comparing base (97811cf) to head (d6f53ed).

Files with missing lines Patch % Lines
internal/datastore/proxy/singleflight.go 89.48% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3048      +/-   ##
==========================================
+ Coverage   75.57%   75.57%   +0.01%     
==========================================
  Files         489      489              
  Lines       59837    59864      +27     
==========================================
+ Hits        45213    45234      +21     
- Misses      11332    11338       +6     
  Partials     3292     3292              

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@miparnisari miparnisari force-pushed the deadlock-singleflight branch 2 times, most recently from 38517ea to 866fb65 Compare April 20, 2026 21:05
@miparnisari miparnisari force-pushed the deadlock-singleflight branch from 866fb65 to a6a72f0 Compare May 2, 2026 00:27
@miparnisari miparnisari force-pushed the deadlock-singleflight branch from 45d61a2 to d6f53ed Compare May 2, 2026 00:55
@github-actions github-actions Bot added area/cli Affects the command line area/tooling Affects the dev or user toolchain (e.g. tests, ci, build tools) labels May 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/cli Affects the command line area/datastore Affects the storage system area/tooling Affects the dev or user toolchain (e.g. tests, ci, build tools)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant