-
Notifications
You must be signed in to change notification settings - Fork 452
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
Investigate and Implement shutdown()
and isShutdown()
for NetHttpTransport
#1850
Comments
We have Line 160 in 13edd13
The only subclass that implements shutdown is ApacheHttpTransport: Line 211 in 13edd13
Does that mean we have less classes to modify (i.e. simply set isShutdown to true as default behavior of shutdown() in HttpTransport ) or that we need to implement shutdown + isShutdown in all the other subclasses
cc: @suztomo |
Adding more context from my recollection. I believe we currently only implement Ideally, we'd like to be have |
@lqiu96 @diegomarquezp I picked up this issue in the backlog. After briefed through all the above comments, I think the task here is to implement |
Let me fix the title since it probably gives the wrong idea of what to try and do. The goal of this originally was to investigate how feasible it was to implement a I don't know the context as to why The last part of this is to add Hope that clears it up and let me know if anything is confusing. |
isShutdown()
for HttpTransportshutdown()
and isShutdown()
for HttpTransport Types
@lqiu96 Thanks for the clarification. Though one more question, do we need to implement |
Hi @lqiu96, I did some investigation on Lines 165 to 177 in 17bbfc1
Therefore no closable resources associated with To implement close() on |
(Saying the below with the context that I'm not extremely familiar with how the library is written or how it works)
I wonder if there is another spot that somehow keeps track of the connection. It seems a bit odd for the library to just be opening the connections and never resource managing/ closing them. If it turns out that it is just opening the connections and never closing them, then I think we definitely need to implement closing them (potentially with the proposed solution above). @JoeWang1127 Is this something that you can confirm? It also may be outside of the scope of this ticket/ we may need to create multiple tickets based on these findings. |
I'm not familiar with |
I took a quick look and I believe I the Lines 153 to 155 in 17bbfc1
It may be possible store a list of the connections that have been opened. Might have some unintended side effects... Off the top of my head (which may or may not end up being a concern): If most connections are closed properly, we may end up holding a list of closed connections that just exist in the list for long running processes. |
Avoid keeping unnecessary resources open. |
After discuss with @blakeli0, this issue is limited to implement |
shutdown()
and isShutdown()
for HttpTransport Typesshutdown()
and isShutdown()
for NetHttpTransport
I thought building request (but not sending it) might be a source of memory leak. However, it seems not true. I create a project to build get request in an infinite loop and the memory usage is stable: |
From: googleapis/sdk-platform-java#1677 (comment)
It would be nice to be able to have a method to determine if a transport has been properly shutdown. Investigate the different clients and how to handle logic for determining if it's been shutdown or not.
The text was updated successfully, but these errors were encountered: