partition_unique leaks metadata references for completed and duplicate records
Bewertung
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Anfängerfreundlichkeit
- 25/100
Rechercherichtung
Start at partition_unique and inspect the shared retain/release helpers, then add regressions for keep="first", keep="last", and metadata shape. Verify discarded references are released immediately, synchronous completion leaves no references retained, and buffered downstream nodes keep references until processing finishes. An open pull request (#502) is already linked to this issue.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
partition_unique retains metadata references for every input, but does not release them when a duplicate is discarded (keep="first") or replaced (keep="last"). It also emits nested metadata lists, while the shared retain/release helpers expect a flat list of dictionaries. Even a completed partition with a synchronous sink leaves its references retained.
Reproduced on master 5267116f49fc2257e39b44abd8d1e5c5460715f8, Windows Python 3.12.14:
from streamz import Stream, RefCounter
for keep in ("first", "last"):
source = Stream()
output = source.partition_unique(2, keep=keep).sink_to_list()
refs = [RefCounter() for _ in range(3)]
for value, ref in zip((1, 1, 2), refs):
source.emit(value, metadata=[{"ref": ref}])
print(keep, output, [ref.count for ref in refs])
Actual: both modes output [(1, 2)] with counts [1, 1, 1]. Expected: [0, 0, 0] after the synchronous sink finishes; discarded records should release their references immediately. Buffered downstream nodes must still retain references until they finish processing.
I plan a narrow fix in partition_unique: release discarded metadata, flatten retained metadata for emission, and add first/last ownership and metadata-shape regressions. Searches found the original feature PR #389 but no current fix for this issue. Is there existing work or a preferred approach?
AI disclosure: this report and proposed contribution were prepared and reproduced by Codex under the account owner authorization. I am not claiming an active production use case or manual human review.
- Vorherrschende Sprache
- Python
- Sterne
- 1.3k
- Forks
- 150
- Ø Merge
- 17 Std. 39 Min.
- Gemergte PRs (30 T.)
- 1
Entwicklungsumgebung
- Enthält ein Dockerfile oder eine Docker-Compose-Datei
- Keine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus python-streamz/streamz
-
pkg_resources warningOffen
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 35/100
python-streamz/streamz#481 · 4 Kommentare ·
-
Combining the streamz.Stream.filenames() and streamz.Stream.from_textfile() using dask scatter?Offen
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 25/100
python-streamz/streamz#480 · 2 Kommentare ·
-
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 20/100
python-streamz/streamz#479 · 1 Kommentar ·
-
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 20/100
python-streamz/streamz#478 · 6 Kommentare ·
-
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 10/100
python-streamz/streamz#476 · 17 Kommentare · 2 Reaktionen ·
Alle Issues in python-streamz/streamz
Ähnliche Issues
-
docs pydanty:is-working
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
pydantic/pydantic-ai#10113 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 77/100
GreedyBear-Project/GreedyBear#1727 ·
Maintainer antworten meist innerhalb von 2 Tagen
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 84/100
ARM-software/CMSIS-DSP#354 ·
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
kiat/codeAssist#391 ·
-
needs triage
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 83/100
darnitdevorg/darnit#587 ·
Maintainer antworten meist innerhalb von 1 Tag