Skip to content
This repository has been archived by the owner on Feb 12, 2024. It is now read-only.

Add locks for pinning #2103

Closed
dirkmc opened this issue May 23, 2019 · 1 comment
Closed

Add locks for pinning #2103

dirkmc opened this issue May 23, 2019 · 1 comment
Assignees
Labels
exp/wizard Extensive knowledge (implications, ramifications) required kind/bug A bug in existing code (including security flaws) kind/resolved-in-helia P1 High: Likely tackled by core team if no one steps up status/ready Ready to be worked

Comments

@dirkmc
Copy link
Contributor

dirkmc commented May 23, 2019

Currently there is no locking mechanism when modifying pins.

We should take a lock when performing any kind of pin operation, in order to prevent simultaneous pin operations from interfering with each other.

For example when adding a pin, we

  • resolve the path
  • get the object
  • flush the pins
    • store direct pins (1)
    • store recursive pins (2)
    • store a reference to the direct/recursive nodes (1 & 2)
    • save the resulting CID to the datastore

Without locking, any of these asynchronous operations may occur concurrently and cause out-of-date or incomplete pin sets to to be stored.

The pin operations are currently managed in

I believe changes will only need to be made in pin.js, however the Garbage Collection PR includes some refactoring such that this structure will change somewhat, so I would suggest implementing a fix for this issue after the GC PR has landed.

We can refer to the go implementation of pinning for inspiration.

@alanshaw alanshaw added kind/bug A bug in existing code (including security flaws) exp/wizard Extensive knowledge (implications, ramifications) required P1 High: Likely tackled by core team if no one steps up status/ready Ready to be worked labels May 24, 2019
@SgtPooki SgtPooki moved this to 🥞 Todo in js-ipfs deprecation May 17, 2023
@whizzzkid whizzzkid moved this from 🥞 Todo to 🛑 Blocked in js-ipfs deprecation May 24, 2023
@whizzzkid
Copy link

whizzzkid commented May 31, 2023

js-ipfs is being deprecated in favor of Helia. You can follow the migration plan here #4336 and read the migration guide.

This issue has been resolved in Helia! if this does not address your concern please let us know by reopening this issue before 2023-06-05!

@github-project-automation github-project-automation bot moved this from 🛑 Blocked to ✅ Done in js-ipfs deprecation May 31, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
exp/wizard Extensive knowledge (implications, ramifications) required kind/bug A bug in existing code (including security flaws) kind/resolved-in-helia P1 High: Likely tackled by core team if no one steps up status/ready Ready to be worked
Projects
No open projects
Status: Done
Development

No branches or pull requests

3 participants