Identify database race conditions

Open
#2,721 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
25/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
aws, python
Domain
backend, databases

Research direction

Start by reviewing the database operations, especially update operations, in the internal dynamo library at lib/dynamo/dynamo; trace multi-query flows and credit-related operations for possible race conditions. Then inspect production API Lambda logs for DatabaseConditionException occurrences since early 2024. The issue is complete when potential race conditions or failing condition checks are documented as follow-up issues, or the review finds none.

Written by the indexing model from the issue text.

Description

Jira Bug

Jira: https://asfdaac.atlassian.net/browse/TOOL-4691

Note: The above link is accessible only to members of ASF.


It may be worthwhile to review our internal dynamo library for potential DynamoDB race conditions, especially if we ever offer a pay-for-processing deployment in which users are actually paying for credits.

We already attempt to guard against the obvious cases via use of ConditionExpression in many of our queries, but there could be subtler race conditions, especially when multiple database queries are involved; for example, see https://github.com/ASFHyP3/hyp3/issues/2720 (not really a race condition itself, but it's a consequence of a change we made to address a race condition, details in the issue).

It's entirely possible that we won't identify any important issues. But it still might be worth reviewing our database operations (particularly update operations) and creating follow-up issues for potential race conditions, if any are found, especially where the user's credits are concerned.

It might also be worth doing a query of prod HyP3's API Lambda logs for occurrences of DatabaseConditionException (which is our custom exception for failed ConditionExpression checks and appears as an Internal Server Error for the user) since early 2024 (which I believe is when we added that exception type), to see if any of our existing ConditionExpression checks have been failing.

Dominant language
Python
Stars
53
Forks
13
Avg merge
1d 2h
Merged PRs (30d)
20

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from ASFHyP3/hyp3

All issues in ASFHyP3/hyp3

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.