Skip to content
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

With gun-2.0.0-rc.1, apns reconnections are much more frequent than with gun-1.3.3 #245

Closed
jainygaurav opened this issue Mar 9, 2021 · 3 comments

Comments

@jainygaurav
Copy link

jainygaurav commented Mar 9, 2021

This is in continuation with: #242.

Why reconnections are more in gun-2.0.0-rc.1 compared to gun-1.3.3? Please help.

OTP: 19.3.6
git clone https://github.com/inaka/apns4erl.git

{deps, [
  {gun, "2.0.0-rc.1"},   --------------------> **it was 1.3.3 when I cloned anps4erl**.
  {unicode_util_compat, "0.7.0"},
  {jsx, "3.0.0"},
  {base64url, "1.0.1"}
]}.

When apns4erl was built with gun-1.3.3, it was hitting issue #242. To resolve that issue, I build apns4erl with gun-2.0.0-rc.1.

  • Since then, apns reconnections are much more frequent

  • From log timestamps, it looks like for every 2 hours.

  • However, I am able to send push notifications after reconnections and without any restart.

  • I print these logs as errors when apns4erl sends {reconnecting, ServerPid} or {connection_up, ServerPid} messages to my gen_server

> 2021-03-09 03:59:10.501 [error] <0.497.0>@mod_tymeit_apns:handle_info:72 apns trying reconnecting with ServerPid <0.509.0>
> 2021-03-09 03:59:11.548 [error] <0.497.0>@mod_tymeit_apns:handle_info:75 apns connection_up with ServerPid <0.509.0>
> 2021-03-09 05:59:11.571 [error] <0.497.0>@mod_tymeit_apns:handle_info:72 apns trying reconnecting with ServerPid <0.509.0>
> 2021-03-09 05:59:12.618 [error] <0.497.0>@mod_tymeit_apns:handle_info:75 apns connection_up with ServerPid <0.509.0>
> 2021-03-09 07:59:12.641 [error] <0.497.0>@mod_tymeit_apns:handle_info:72 apns trying reconnecting with ServerPid <0.509.0>
> 2021-03-09 07:59:13.693 [error] <0.497.0>@mod_tymeit_apns:handle_info:75 apns connection_up with ServerPid <0.509.0>
> 2021-03-09 09:59:13.716 [error] <0.497.0>@mod_tymeit_apns:handle_info:72 apns trying reconnecting with ServerPid <0.509.0>
> 2021-03-09 09:59:14.764 [error] <0.497.0>@mod_tymeit_apns:handle_info:75 apns connection_up with ServerPid <0.509.0>
> 2021-03-09 11:59:14.787 [error] <0.497.0>@mod_tymeit_apns:handle_info:72 apns trying reconnecting with ServerPid <0.509.0>
> 2021-03-09 11:59:15.832 [error] <0.497.0>@mod_tymeit_apns:handle_info:75 apns connection_up with ServerPid <0.509.0>
> 2021-03-09 13:59:15.855 [error] <0.497.0>@mod_tymeit_apns:handle_info:72 apns trying reconnecting with ServerPid <0.509.0>
> 2021-03-09 13:59:17.067 [error] <0.497.0>@mod_tymeit_apns:handle_info:75 apns connection_up with ServerPid <0.509.0>
> 
> 2021-03-09 15:38:29.407 [error] <0.497.0>@mod_tymeit_apns:sendAPNS:320 Success in request. Reason was: 200 with <<"9z1f88da4e9c5dsa87a6d186dad745b3b6817d9fd2ddea095fgfgdfa608c0929d31d">>
> 

@jainygaurav
Copy link
Author

jainygaurav commented Mar 9, 2021

Looks like apns4erl or gun reconnects every two hours if there was no activity on the connection.

  • Here it reconnected.
2021-03-09 13:59:15.855 [error] <0.497.0>@mod_tymeit_apns:handle_info:72 apns trying reconnecting with ServerPid <0.509.0>
2021-03-09 13:59:17.067 [error] <0.497.0>@mod_tymeit_apns:handle_info:75 apns trying connection_up with ServerPid <0.509.0>

  • Here I sent a notification before two hours expire.
 2021-03-09 15:38:29.407 [error] <0.497.0>@mod_tymeit_apns:sendAPNS:320 Success in request. Reason was: 200 with 
 <<"9z1f88da4e9c5dsa87a6d186dad745b3b6817d9fd2ddea095fgfgdfa608c0929d31d">>

  • Now it tries to reconnect two hours from the time I sent the notification
2021-03-09 17:38:29.472 [error] <0.497.0>@mod_tymeit_apns:handle_info:72 apns trying reconnecting with ServerPid <0.509.0>
2021-03-09 17:38:30.517 [error] <0.497.0>@mod_tymeit_apns:handle_info:75 apns connection_up with ServerPid <0.509.0>
2021-03-09 19:38:30.540 [error] <0.497.0>@mod_tymeit_apns:handle_info:72 apns trying reconnecting with ServerPid <0.509.0>
2021-03-09 19:38:31.587 [error] <0.497.0>@mod_tymeit_apns:handle_info:75 apns connection_up with ServerPid <0.509.0>

@ferigis
Copy link
Member

ferigis commented Mar 9, 2021

hi, this issue is more related with gun because we are built on top of 1.3.3 version and we don't plan to migrate it to a release candidate dependency.

If you find any error with that gun version it would be good to share with gun folks, since it is still in a release candidate phase.

@ferigis ferigis closed this as completed Mar 9, 2021
@jainygaurav
Copy link
Author

jainygaurav commented Mar 9, 2021

@ferigis But apns4erl with gun-1.3.3 runs into #242. That was the reason I tried using gun-2.0.0-rc.1.

Is it possible to fix #242 with gun-1.3.3? Should I re-open #242?

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

No branches or pull requests

2 participants