GithubHelp home page GithubHelp logo

Comments (4)

imhoffd avatar imhoffd commented on August 16, 2024

@cissoid Odd. Once the Client is removed from the ClientManager, the reference to it should be lost and Go should GC it and close the connections automatically, shouldn't it? Is there anything in the code that doesn't exhibit that behavior?

Each client has its own Transport, which means calling CloseIdleConnections() on it won't affect other clients. I would be concerned when a client is "checked out" from the ClientManager and being used. CloseIdleConnections() wouldn't affect it, but it also wouldn't clean up after itself properly when the client is removed.

from apns2.

cissoid avatar cissoid commented on August 16, 2024

@dwieeb

Once the Client is removed from the ClientManager, the reference to it should be lost and Go should GC it and close the connections automatically

I took a look at go source code. After connection created, there will start a new goroutine to run read loop, so there's should have another reference point to the connection, see https://github.com/golang/net/blob/master/http2/transport.go#L573.

The read loop will close connection only if keepalive on current connection is disabled, and exit loop only when read error, see https://github.com/golang/net/blob/master/http2/transport.go#L1458.

I'm not sure but this might be the reason.

from apns2.

imhoffd avatar imhoffd commented on August 16, 2024

@cissoid That behavior makes sense, I suppose. We could set DisableKeepAlives to true on the transport after a client is removed.

from apns2.

cissoid avatar cissoid commented on August 16, 2024

@dwieeb That not works, DisableKeepAlives only checked when read loop starting, change it after connection created seems no effect.

from apns2.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.