user20230119
GenServer #PID<0.7281.0> terminating tcp_closed error messages
Phoenix app in a Docker container is filling log with this in production on an Azure Web App.
Another post suggested hackney and httpoison is causing it.
How can I find the cause of the errors?
I can ssh to the container and run /app/bin/app_name remote to start iex.
Do I need to create a ssh tunnel to remote debug the node?
In the container I can run:
/app/erts-13.2.2/bin/epmd -namesto find the remote port
epmd: up and running on port 4369 with data:
name app_name at port 40699
2023-08-27T11:00:31.165568384Z 11:00:31.165 [error] GenServer #PID<0.7281.0> terminating
2023-08-27T11:00:31.165607985Z ** (stop) :tcp_closed
2023-08-27T11:00:31.165614385Z Last message: {:tcp_closed, #Port<0.1783>}
2023-08-27T11:00:44.382799422Z 11:00:44.382 [error] GenServer #PID<0.7294.0> terminating
2023-08-27T11:00:44.382851424Z ** (stop) :tcp_closed
2023-08-27T11:00:44.382857724Z Last message: {:tcp_closed, #Port<0.1787>}
2023-08-27T11:00:50.868232946Z 11:00:50.867 [error] GenServer #PID<0.7306.0> terminating
2023-08-27T11:00:50.868293847Z ** (stop) :tcp_closed
2023-08-27T11:00:50.868302347Z Last message: {:tcp_closed, #Port<0.1791>}
2023-08-27T11:00:55.510507526Z 11:00:55.509 [error] GenServer #PID<0.7318.0> terminating
2023-08-27T11:00:55.510555327Z ** (stop) :tcp_closed
2023-08-27T11:00:55.510560527Z Last message: {:tcp_closed, #Port<0.1795>}
Most Liked
hkrutzer
How many connections are you opening? Azure has a limit on the amount of outgoing connections you can have. You need to check the limit for your instance size. You should also have a look around in the “Diagnose and solve problems” menu, it sometimes actually contains useful data.
Personally the next steps I would take are:
- Ensure you are on a recent Erlang version
- Try to reproduce the issue by manually create a connection as described here GitHub - elixir-ecto/tds: TDS Driver for Elixir preferably from inside the container
- Try to find out what could be causing the error, which should be around here: https://github.com/elixir-ecto/tds/blob/11e1f461f24c5497cd85ebf50c717bd49927b41c/lib/tds/tls.ex#L85-L88
- Looking at the lines above, it might be the connection timing out, as the function is named “assert_connected”. If this is a possiblity then see if you can send keepalive packets by setting some TCP setting.
hkrutzer
You are getting less errors because there are less database connections that are getting closed. I would still try to connect with the TDS driver directly, maybe even from your own machine to the Azure DB.







