Skip to content

Remove ServiceBrowser as a listener from Zeroconf when the service finishes#20

Closed
morpav wants to merge 1 commit into
python-zeroconf:masterfrom
morpav:master
Closed

Remove ServiceBrowser as a listener from Zeroconf when the service finishes#20
morpav wants to merge 1 commit into
python-zeroconf:masterfrom
morpav:master

Conversation

@morpav
Copy link
Copy Markdown

@morpav morpav commented Apr 11, 2015

Not removing the service causes that it cannot be collected by garbage collector when the service is cancelled. Other objects can be blocked transitively as well, e.g. listener passed to ServiceBrowser's init etc.

…nishes

Not removing the service causes that it cannot be collected by garbage
collector when cancelled (other objects transitively as well).
@coveralls
Copy link
Copy Markdown

Coverage Status

Coverage increased (+0.35%) to 75.68% when pulling 0705551 on morpav:master into 4dbd04b on jstasiak:master.

3 similar comments
@coveralls
Copy link
Copy Markdown

Coverage Status

Coverage increased (+0.35%) to 75.68% when pulling 0705551 on morpav:master into 4dbd04b on jstasiak:master.

@coveralls
Copy link
Copy Markdown

Coverage Status

Coverage increased (+0.35%) to 75.68% when pulling 0705551 on morpav:master into 4dbd04b on jstasiak:master.

@coveralls
Copy link
Copy Markdown

Coverage Status

Coverage increased (+0.35%) to 75.68% when pulling 0705551 on morpav:master into 4dbd04b on jstasiak:master.

@jstasiak
Copy link
Copy Markdown
Collaborator

@morpav Sorry for the delay, thanks for this patch. Can you provide some additional information regarding what exactly cannot be collected and when?

@stephenrauch
Copy link
Copy Markdown
Collaborator

Thanks so much for the pull request.

I made several improvements to ZC() shutdown, including incorporating these changes, before I had access to this repo. As of now I believe the functionality from this PR has been incorporated, and I unfortunately have no good way to merge the PR to give you credit for the change, so I am going to close it.

If you think this an error, or an otherwise bad idea, please comment back.

Thanks again for your help.

@morpav
Copy link
Copy Markdown
Author

morpav commented Jul 3, 2016

@jstasiak It is really long time ago, but if I remember correctly, the class updated in the PR (ServiceBrowser) registered itself into an externally provided "zc" instance in constructor. But it never did the opposite when being cancelled. So all resources acquired/referenced by the ServiceBrowser instance was not freed transitively as well. So a kind of memory leak occurred.

@stephenrauch The PR was super simple so I'm sure you did it right :) Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants