GenServer ** (EXIT from #PID<0.368.0>) shell process exited with reason: shutdown

18:23:47.874 [error] GenServer Server.Laboratoray terminating
** (HTTPoison.Error) :timeout
    (httpoison 1.7.0) lib/httpoison.ex:128: HTTPoison.request!/5
    (arbit 0.1.0) lib/Sandbox.ex:8:
    (arbit 0.1.0) lib/Sandbox.ex:104:
    (arbit 0.1.0) lib/Laboratoray.ex:111: Laboratoray.main/0
    (arbit 0.1.0) lib/GenServers/Server.Laboratoray.ex:26: Server.Laboratoray.handle_info/2
    (stdlib 3.13.2) gen_server.erl:680: :gen_server.try_dispatch/4
    (stdlib 3.13.2) gen_server.erl:756: :gen_server.handle_msg/6
    (stdlib 3.13.2) proc_lib.erl:226: :proc_lib.init_p_do_apply/3
Last message: :tick
State: :running
** (EXIT from #PID<0.368.0>) shell process exited with reason: shutdown

How can handle_info be used to retry the connection?

It seems that the Genserver is down because of HTTPoison failure. In order to allow a retry, the genserver needs to be supervised. The supervisor will catch the failure and try it again. (according to the child spec defined for your genserver)
Please read “


rescue HTTPoison.Error or use HTTPoison.request and handle {:error, :timeout} return value.