Track active_writers without depending on GC/refcounting #3269

Open
opened 2019-12-18 23:08:20 +00:00 by meejah · 0 comments
meejah commented 2019-12-18 23:08:20 +00:00
Owner

In storage.server (here https://github.com/tahoe-lafs/tahoe-lafs/blob/master/src/allmydata/storage/server.py#L70) the use of WeakKeyDictionary to track active writers effectively makes the API depend on CPython's ref-counting. It's also kind of a terrible API ("when the last writer is not referenced, and is reclaimed, then we're not writing to it any more"). Also, it won't work under PyPy which uses actual garbage-collection.

There should instead be an explicit API to indicate a writer is done (and if any remaining gc.collect() exist in the unit-tests these should be removed).

In `storage.server` (here <https://github.com/tahoe-lafs/tahoe-lafs/blob/master/src/allmydata/storage/server.py#L70>) the use of `WeakKeyDictionary` to track active writers effectively makes the API depend on CPython's ref-counting. It's also kind of a terrible API ("when the last writer is not referenced, and is reclaimed, then we're not writing to it any more"). Also, it won't work under [PyPy](wiki/PyPy) which uses actual garbage-collection. There should instead be an explicit API to indicate a writer is done (and if any remaining `gc.collect()` exist in the unit-tests these should be removed).
tahoe-lafs added the
code-storage
normal
defect
n/a
labels 2019-12-18 23:08:20 +00:00
tahoe-lafs added this to the soon milestone 2019-12-18 23:08:20 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: tahoe-lafs/trac-2024-07-25#3269
No description provided.