Skip to content
This repository was archived by the owner on Jun 15, 2020. It is now read-only.
This repository was archived by the owner on Jun 15, 2020. It is now read-only.

Investigate Concurrency Issues #94

@andrewkchan

Description

@andrewkchan

https://github.com/codebase-berkeley/CodeDoor/blob/908787266a95e2c61131885ee6a6aeb403a78fd8/codebank/utils/transaction.py#L39

transaction.atomic() does not lock the entire table, it only journals the queries so they can be rolled back safely. On the other hand select_for_update() locks the selected row. In the current mode send_codebucks can cause a deadlock if 2 users try to send codebucks to each other, each request could acquire the sender lock and wait on the recipient lock forever. Postgres will detect this and raise an exception, and the fix would be to just restart one of the transactions until the deadlock goes away.

There may be more edge cases possible when using row-level locks that I haven't thought of. Should investigate these issues sometime, and consider locking the entire table (slow!).

Metadata

Metadata

Assignees

No one assigned

    Labels

    codebankAnything related to codebank

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions