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

Delete race in ARC cache #64

Closed
Closed
@Stebalien

Description

@Stebalien

Steps:

  1. Call Put & Delete on the same block at the same time.
  2. After finishing step 1, call Put on the block.

After step 1, the block may or may not be in the blockstore depending on how the operations serialize. However, after step 2, the block must be in the datastore.

Unfortunately, there's a race:

  1. Put 1: put the block.
  2. Delete 1: Delete the block.
  3. Delete 1: Cache that we don't have the block.
  4. Put 1: Cache that we have the block.
  5. Put 2: Check the cache, see that we should have the block, and walk away.

There's also a similar race between get & delete and get & put.

Fix: add striped (by CID) locking.
Impact:

  1. Put & Delete: data loss (in go-ipfs, requires GC)
  2. Get & Delete: data loss (in go-ipfs, requires GC)
  3. Get & Put: Inability to retrieve a block from the datastore (until restarting).

Metadata

Metadata

Assignees

Labels

P0Critical: Tackled by core team ASAPkind/bugA bug in existing code (including security flaws)need/triageNeeds initial labeling and prioritization

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions