ninenines/gun

gun-2.0.0-rc.1 - HTTP/2 connection process exits after 2 hours of no-use?

jainygaurav opened this issue · 2 comments

  • I use apns4erl which uses gun-1.3.3 which runs into issue #261.

  • So, I used gun-2.0.0-rc.1 with apns4erl as suggested in #261.

  • However, gun-2.0.0-rc.1 - HTTP/2 connection process exits if there is no activity on the connection for 2 hours.

  • apns4erl receives DOWN message from gun and reconnects.

  • For more information on this issue: inaka/apns4erl#245.

Is there a gun config option that would make it work like 1.3.3 (i.e. gun-1.3.3 does not disconnect after 2 hours of no-use)?

Please help.

essen commented

This is probably the server closing the connection because Gun no longer sends pings by default (see keepalive option). But I'm not sure I understand, is there a problem? I don't think there is. Gun properly reconnects and you haven't lost any requests.

@essen thank you for confirming. I was able to resolve this issue by:

{ Host
                           , Port
                           , #{ protocols      => [http2]
                              , tls_opts => TransportOpts
                              , http_opts => #{keepalive => 5000}
                              , http2_opts => #{keepalive => 5000}
                              , retry          => 0
                              }}