Skip to content

network failure on init causes application crash #295

@mccraigmccraig

Description

@mccraigmccraig

Environment

  • Elixir & Erlang/OTP versions (elixir --version):
    • elixir 1.18.3-otp-27
    • erlang 27.3.3
  • Operating system:
    • MacOS & Ubuntu
  • Pigeon version:
    • pigeon 2.0.1

Current behavior

When our application is started without a network (e.g. on a laptop with no active connection) then the Pigeon FCM and APNS supervisors crash and cause the application to fail

This isn't great for on-the-move development, but it's easy to workaround in a local environment

More concerning is that our application startup is now dependent on Pigeon successfully initiating connections to Firebase and APNS - so I can imagine a situation where some 3rd party network failure renders our application pods unable to start, and because of K8S load-balancing scaling up and down the whole API will soon die

Here's the error I'm seeing on application startup:

** (Mix) Could not start application backend: Backend.Application.start(:normal, []) returned an error: shutdown: failed to start child: Backend.PushNotifications.FCM
    ** (EXIT) shutdown: failed to start child: 1
        ** (EXIT) {{{:badmatch, {:error, {{:badmatch, {:error, :nxdomain}}, [{Kadabra.Connection, :init, 1, [file: ~c"lib/connection.ex", line: 44]}, {:gen_server, :init_it, 2, [file: ~c"gen_server.erl", line: 2229]}, {:gen_server, :init_it, 6, [file: ~c"gen_server.erl", line: 2184]}, {:proc_lib, :init_p_do_apply, 3, [file: ~c"proc_lib.erl", line: 329]}]}}}, [{Kadabra.ConnectionPool, :init, 1, [file: ~c"lib/connection_pool.ex", line: 59]}, {:gen_server, :init_it, 2, [file: ~c"gen_server.erl", line: 2229]}, {:gen_server, :init_it, 6, [file: ~c"gen_server.erl", line: 2184]}, {:proc_lib, :init_p_do_apply, 3, [file: ~c"proc_lib.erl", line: 329]}]}, {:child, :undefined, #Reference<0.1652344825.142606341.32331>, {Kadabra.ConnectionPool, :start_link, [%URI{scheme: "https", authority: "fcm.googleapis.com", userinfo: nil, host: "fcm.googleapis.com", port: 443, path: nil, query: nil, fragment: nil}, #PID<0.1309.0>, [ssl: [{:active, :once}, {:packet, :raw}, {:reuseaddr, true}, {:alpn_advertised_protocols, ["h2"]}, :binary]]]}, :transient, false, 5000, :worker, [Kadabra.ConnectionPool]}}

Expected behavior

If configuration is good, then a failure to open a connection to Firebase or APNS should not cause a failure of the Pigeon supervisors

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions