crispinb

crispinb

TLS connections fail with OTP-24 (in one project only)

I have a Phoenix project which doesn’t accept TLS connections when compiled & run with Elixir 1.12 & Erlang OTP-24. Everything’s fine with Elixir 1.12.0-rc.1 & OTP-23. I switch between versions using asdf (and delete _build and refresh the deps when switching).

If I create a new Phoenix project using 1.12/OTP-24, that works, so this is something project-specific.

The failure is https only (http connections to the same running process are fine). I’m using a self-signed cert generated with mix phx.gen.cert. It looks like it’s happening very early in the process as client connection attempts aren’t met at all:

 curl -v https://localhost:4001
*   Trying 127.0.0.1:4001...
* TCP_NODELAY set
* Connected to localhost (127.0.0.1) port 4001 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* successfully set certificate verify locations:
*   CAfile: /etc/ssl/certs/ca-certificates.crt
  CApath: /etc/ssl/certs
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
* Operation timed out after 300599 milliseconds with 0 out of 0 bytes received
* Closing connection 0
curl: (28) Operation timed out after 300599 milliseconds with 0 out of 0 bytes received

In the console I get this when the failure happens, which my Elixir/Erlang/BEAM knowledge isn’t up to interpreting:

[error] Ranch listener XXXWeb.Endpoint.HTTPS had connection process started with
:cowboy_tls:start_link/4 at #PID<0.677.0> exit with reason: {:undef, [{:ssl, :ssl_accept,
[{:sslsocket, {:gen_tcp, #Port<0.40>, :tls_connection, [option_tracker: #PID<0.524.0>,
session_tickets_tracker: :disabled, session_id_tracker: #PID<0.525.0>]}, [#PID<0.676.0>,
#PID<0.675.0>]}, [], 5000], []}, {:ranch_ssl, :handshake, 3, [file:
'/home/crispinb/src/XXX/deps/ranch/src/ranch_ssl.erl', line: 142]}, {:ranch, :handshake, 2, [file:
'/home/crispinb/src/XXX/deps/ranch/src/ranch.erl', line: 243]}, {:cowboy_tls, :connection_process,
4, [file: '/home/crispinb/src/XXX/deps/cowboy/src/cowboy_tls.erl', line: 43]}, {:proc_lib,
:init_p_do_apply, 3, [file: 'proc_lib.erl', line: 226]}]}

The project itself is very simple (as it must be - I’m just learning Phoenix) with only these deps:

      {:bcrypt_elixir, "~> 2.0"},
      {:phoenix, "~> 1.5.8"},
      {:phoenix_ecto, "~> 4.1"},
      {:ecto_sql, "~> 3.4"},
      {:postgrex, ">= 0.0.0"},
      {:phoenix_html, "~> 2.11"},
      {:phoenix_live_reload, "~> 1.3", only: :dev},
      {:phoenix_live_dashboard, "~> 0.4"},
      {:telemetry_metrics, "~> 0.4"},
      {:telemetry_poller, "~> 0.4"},
      {:gettext, "~> 0.11"},
      {:jason, "~> 1.0"},
      {:plug_cowboy, "~> 2.0"},
      {:credo, "~> 1.5", only: [:dev, :test], runtime: false},
      {:tz, "~> 0.16.0"},
      {:phx_gen_auth, "~> 0.7.0"},
      {:earmark, "~> 1.4"},
      {:phoenix_html_sanitizer, "~> 1.0.0"}

Any hints much appreciated!

Marked As Solved

voltone

voltone

Try to upgrade Ranch: mix deps.update ranch. The error suggests your version of ranch is still using the old :ssl.ssl_accept/1,2,3 API, which was deprecated some time ago and has been removed in OTP 24.

Also Liked

bartblast

bartblast

Creator of Hologram

Looks like ranch >= 1.8.0 fixes the problems.

crispinb

crispinb

I have discovered mix deps.tree. Nice!

Where Next?

Popular in Questions Top

baxterw3b
Hi guys, i’m new in the Elixir world, and i have to say, that i love it! i’m having some problem to understand anonymous functions with ...
New
shahryarjb
Hello, I get Persian date from my client and convert it to normal calendar like this: def jalali_string_to_miladi_english_number(persi...
New
fireproofsocks
I’m working on defining a simple Ecto schema for a table (in PostGres), but I don’t see where I can define a column as NOT NULL. Conside...
New
johnnyicon
Hi all, I’ve just started learning Elixir and Phoenix Framework, so please pardon my n00bness at this stage. I’m trying to use Postgres...
New
pmjoe
I have a relationship of love and hate with Elixir. Lots of things are just absolutely right, but there are some things that are kind of ...
New
JulienCorb
I am trying to implement my new.html.eex file to create new posts on my website. new.html.eex: &lt;h1&gt;Create Post&lt;/h1&gt; &lt;%= ...
New
Emily
I have VueJS GUIs with the project generated using Webpack. I have Elixir modules that will need to be used by the VueJS GUIs. I forese...
New
aalberti333
As the title describes, I’m trying to run Enum.map() over a list of key/value pairs, where the value is a map. My data looks like this: ...
New
dblack
I’ve got an issue with an app and I’ve no idea of how to troubleshoot it. I’m hoping someone here might have seen something similar. I p...
New
PeterCarter
There are pre-rolled solutions for other frameworks that do work. However, Phoenix does not seem to have these. Have people had good expe...
New

Other popular topics Top

aadeshere1
I have a another noob question about loop. Since elixir is immutable, while loop is not directly possible. total = 10 while total != 0 ...
New
vertexbuffer
Hello, can anybody help here..? I have a list of players and I what to delete an element, but every for loop the list is reverting to ori...
New
marius95
Hello everyone, I try to use an Javascript Event Handler in my root.html.leex file. Therefore I created a function in the app.js file: ...
New
baxterw3b
Hi guys, i’m new in the Elixir world, and i have to say, that i love it! i’m having some problem to understand anonymous functions with ...
New
pmjoe
I have a relationship of love and hate with Elixir. Lots of things are just absolutely right, but there are some things that are kind of ...
New
fireproofsocks
Forgive me if this is obvious, but how does one delete a database record WITHOUT selecting it first? Ecto.Repo — Ecto v3.14.0 has exampl...
New
stefanchrobot
What’s the safe way to decode a JSON string into a struct? I want to avoid calling String.to_atom. Jason.decode can give me a map with st...
New
aesmail
Hello guys, I have finally made it. I created an admin interface for a framework. It’s been on my todo list for years and with the curre...
New
Emily
I have VueJS GUIs with the project generated using Webpack. I have Elixir modules that will need to be used by the VueJS GUIs. I forese...
New
shijith.k
I am trying to start a new phoenix project with elixir 1.9, but mix phx.new does not work. It says that ** (Mix) The task "phx.new" could...
New

Latest on Elixir Forum

Elixir Forum

We're in Beta

About us Mission Statement