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

Quota handling can lead to deadlock under load #122

Closed
knolleary opened this issue Aug 8, 2024 · 0 comments · Fixed by #123
Closed

Quota handling can lead to deadlock under load #122

knolleary opened this issue Aug 8, 2024 · 0 comments · Fixed by #123
Assignees
Labels
priority:high High Priority size:M - 3 Sizing estimation point
Milestone

Comments

@knolleary
Copy link
Member

Current Behavior

If we receive multiple parallel updates for the some instance, but different scopes, a deadlock can occur.

  1. request received to update instance A, scope B.
  2. Within a transaction, we select the row with an update lock
  3. We determine the change in size of that context entry, but then need to check the total quota usage for the instance - so do a query for all scopes under instance A

If a second update comes in parallel for instance A, scope C, it will achieve a lock on that row. That then blocks the quota check off the first request. Both requests are now deadlocked.

Expected Behavior

Not to deadlock

Steps To Reproduce

Drive multiple requests to different context scopes in parallel.

Environment

  • FlowFuse version:
  • Node.js version:
  • npm version:
  • Platform/OS:
  • Browser:

Linked Customers

  • Customer name and/or link to HubSpot contact
@knolleary knolleary added the needs-triage Needs looking at to decide what to do label Aug 8, 2024
@knolleary knolleary self-assigned this Aug 8, 2024
@knolleary knolleary added priority:high High Priority and removed needs-triage Needs looking at to decide what to do labels Aug 8, 2024
@knolleary knolleary added this to the 2.8 milestone Aug 8, 2024
@knolleary knolleary moved this to In Progress in 🛠 Development Aug 8, 2024
@knolleary knolleary added the size:M - 3 Sizing estimation point label Aug 8, 2024
@github-project-automation github-project-automation bot moved this from In Progress to Done in 🛠 Development Aug 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority:high High Priority size:M - 3 Sizing estimation point
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

1 participant