-
Notifications
You must be signed in to change notification settings - Fork 207
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PubSub: gRPC channel memory leak/not closed. #4
Comments
@codezizo Thanks for the report! When somebody reproduces the behavior and confirms it, the issue will be classified as a bug, but sticking with the |
Hello @plamut , I currently use the api google.cloud.datastore.client with gRPC too. I have the same behavior. for my side the step to reproduce is the following :
if I disable the gRPC channel on the google api client, the memory leak disappears. Grihm |
@GrihmDaVaice Thanks for the extra info! I haven't been able to look at this myself yet, but it indeed appears that the client would need to handle this better. Maybe not by automatically closing the channel by itself, as this could affect other use cases, but perhaps an explicit FWIW, something similar was recently done to the BigQuery client in googleapis/google-cloud-python#9894 that also had a resource leak. In the meantime the subscriber channel can also be closed directly: subscriber.api.transport.channel.close() but that goes quite deep into client internals, and is also not well documented. Also, the client should also not be used in the "closed" state, but it currently does not have any notion of that. A higher-level |
Just as a quick update, I managed to reproduce this even in the latest subscriber client version ( The issue is indeed caused by the underlying channel opening two sockets, but then not closing the channel when deleting the client:
(the first socket is opened by my IDE, while the other two are the channel's) FWIW, the workaround mentioned in my previous comment works (manually closing the channel). |
thanks a lots @plamut , Waiting for the next version, we will try to do this. |
Version 0.42.1
Steps to reproduce
Code example
--- python code ends---
Stack trace
The text was updated successfully, but these errors were encountered: