Repository navigation
fix(#634): drop network event streams for removed access points and devices - #635
Merged
cachebag merged 2 commits intoNov 28, 2026
Merged
Conversation
…s points and devices Signed-off-by: Marvin Froeder <velo.br@gmail.com>
velo
force-pushed
the
fix/634-drop-removed-object-streams
branch
from
November 25, 2026 17:49
7a5cee8 to
ef15e9a
Compare
This comment was marked as resolved.
This comment was marked as resolved.
cachebag
requested changes
Nov 27, 2026
cachebag
left a comment
Member
There was a problem hiding this comment.
Thanks for this! A couple notes
…heir device Signed-off-by: Marvin Froeder <velo.br@gmail.com>
Contributor
Author
|
No worries, thanks for taking a look! Happy Thanksgiving to you too. |
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #634.
run_network_eventspushed a per-object stream into theselect_allfor everyAccessPointAdded/DeviceAdded, but the removal signals discarded the path, so nothing ever ended those streams. A zbus signal/property stream for an object that no longer exists never yieldsNone, so each one kept its proxy, property cache and match rule for the life of the event task. In a long-running consumer (cosmic-applet-network) this reached 2.5 GiB after 18 days, with ~99.5 % of every AccessPoint path NetworkManager had ever created still referenced; numbers are in #634.Change
AccessPointRemovedandDeviceRemovednow carry the object path.futures::stream::abortableand itsAbortHandleis kept in anObjectStreamsmap keyed by the owning object path:AccessPointAdded/AccessPointRemovedstreams under the device path.NoneandSelectAlldrops them.AccessPointAdded/DeviceAddedfor an already-tracked path releases the old streams first, so duplicates no longer accumulate either.Public API and emitted
NetworkEvents are unchanged.Tests
released_object_streams_leave_the_merged_stream: a tracked stream that would never end leaves the merged stream once its object is released.releasing_one_object_keeps_the_others: release is scoped to the path.cargo fmt --check,cargo clippy --all-targets --all-features -D warnings,cargo test --lib --all-features(768 passed) andcargo docwith-D warningspass locally. I did not run the Docker NetworkManager integration harnesses.AI disclosure
The leak was diagnosed and this patch written with Claude Code (Anthropic), working from a core dump of the leaking process: glibc arena walk, live-chunk histogram and object-path counts. Verified by the unit tests above and the local CI checks.