Skip to content

PynamoDB Inconsistent Read Results in High-Concurrency Queue Processing #1288

@baryaner

Description

@baryaner

PynamoDB's get() method occasionally returns stale/incorrect data when multiple queue messages are processed simultaneously, leading to data consistency issues.

Context: Worker processes consuming from a queue, with multiple messages published within the same second
Problem:
The DynamoDB query
CommitTask.get(hash_key=event.commit_id, range_key=event.task_id)
sometimes returns a record where commit_task.task_id doesn't match the expected event.task_id

Inconsistency: Retrying the same get() operation immediately after returns the correct/expected result

Trigger: Issue occurs specifically when queue payloads are published simultaneously (within the same second)

i try to use consistent_read = True but i don't think it's the case here.
any idea where is the problem?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions