gmile

gmile

Issue with using "amqp" package after upgrading to OTP26

After upgrading to OTP26, our app that uses amqp package fails to establish a connecting to RabbitMQ server, and I am failing to understand why. Connecting to OTP25 works fine.

# OTP25
AMQP.Connection.open("amqp://guest:guest@amqp-issue-rabbitmq")
{:ok, %AMQP.Connection{pid: #PID<0.241.0>}}
# OTP26
AMQP.Connection.open("amqp://guest:guest@amqp-issue-rabbitmq")
# => {:error, {:auth_failure, 'Disconnected'}}

I have a hunch this must be related to recent changes to SSL-specific defaults in OTP26. However, attempts to disable ssl_options doesn’t work either - it fails with another error, so I must be passing the options in a wrong way. For example, this fails:

AMQP.Connection.open("amqp://guest:guest@amqp-issue-rabbitmq", [ssl_options: :none])
# => {:error, :econnrefused}
Reproduction details

The reproduce script is this one:

# sample.bash
mix do local.hex --force, local.rebar --force

elixir -e 'Mix.install([:amqp]); AMQP.Connection.open("amqp://guest:guest@amqp-issue-rabbitmq") |> IO.inspect()'

The full reproduce experiment is this one:

docker network create amqp-issue

docker run \
  --rm \
  --name amqp-issue-rabbitmq \
  --detach \
  --network amqp-issue \
  rabbitmq:3.11.16-alpine

sleep 5 # give rabbitmq enough time to fully initialize

docker run \
  --rm \
  --name amqp-issue-otp25 \
  --network amqp-issue \
  --mount type=bind,source=$(realpath sample.bash),target=/tmp/sample.bash \
  hexpm/elixir:1.14.1-erlang-25.1.2-alpine-3.16.2 \
  ash /tmp/sample.bash

docker run \
  --rm \
  --name amqp-issue-otp25 \
  --network amqp-issue \
  --mount type=bind,source=$(realpath sample.bash),target=/tmp/sample.bash \
  hexpm/elixir:1.14.4-erlang-26.0-alpine-3.18.0 \
  ash /tmp/sample.bash

docker stop amqp-issue-rabbitmq

docker network rm amqp-issue

I haven’t dig too deep into amqp_client yet. Any ideas what might be preventing the connection and how to fix it? :thinking:

Marked As Solved

gmile

gmile

:information_source: After upgrading to amqp_client 3.12.0, this issue is resolved now. There’s a chance connecting should also work with 3.11.17, but I wasn’t able to test that.

Also Liked

cevado

cevado

you must probably need to have a version of the server that supports otp26
for reference
https://github.com/rabbitmq/rabbitmq-server/issues/7845

https://github.com/rabbitmq/rabbitmq-server/pull/7927

al2o3cr

al2o3cr

The client implementation and the server share code, according to this note in that second Github issue:

Note that rabbit_net:port_command/2 is not only used by RabbitMQ server, but also by the AMQP 0.9.1 client. Therefore, instead of putting the OTP version (or send function) into persistent_term within the rabbit app, we just do it the first time rabbit_net:port_command/2 is invoked.

gmile

gmile

Just updating the client worked, yes. I’m using cloudamqp too, and connecting using 3.12 client code appears to work now.

However, I only just did some quick tests. Haven’t deployed this yet.

Where Next?

Popular in Questions Top

nobody
How to bind a phoenix app to a specific ip address? could not find anything about that, nowhere, unfortunately, but for me this is quite...
New
sergio
In Ruby, I can go: User.find_by(email: "foobar@email.com").update(email: "hello@email.com") How can I do something similar in Elixir? ...
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
vac
Hi, I’m quite new in Elixir and I’m trying to format a string to a PEM format. I have the certificate value like MIIDBTCCAe2...... and I...
New
itssasanka
Hi all, Trying to get some more clarity over utc_datetime and naive_datetime for Ecto: The documentation above suggests that while ...
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
rms.mrcs
Hi, I need to transform a list of numbers into a map where the keys are the indexes and the values are the original values of the list. ...
New
komlanvi
Hi everyone, I was playing with phoenix liveView but I run into an issue. I have a form and want to validate each input text when the te...
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
jononomo
For some reason my phoenix channels are working for me in my local dev environment, but as soon as I deploy via Docker, I get a 403 error...
New

Other popular topics Top

danschultzer
None of the current solutions worked well for me, so I went ahead and built a user management system from scratch. This project took far...
548 29603 241
New
hariharasudhan94
lets say i have a sample like a = 20; b = 10; if (a &gt; b) do {:ok, "a"} end if (a &lt; b) do {:ok, b} end if (a == b) do {:ok, "equa...
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
JeremM34
Hello, how can I check the Phoenix version ? Thanks !
New
jononomo
I am trying to figure out how Mix knows whether the environment is test, dev, or prod – where is this set? Thanks.
New
chrismccord
Phoenix 1.4.0 released Phoenix 1.4 is out! This release ships with exciting new features, most notably with HTTP2 support, improved deve...
688 31013 112
New
sergio_101
I am VERY much an elixir newbie. I have taken one elixir course and one phoenix course on Udemy. During that course, I saw the instructor...
New
jason.o
In the code below, if the create action is not set to accept “extra_key” as an input, it errors out with a message shown above. Is there ...
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
JakeBecker
TL;DR: I’ve just released an implementation of Microsoft’s IDE-independent Language Server Protocol for Elixir. It adds language support ...
1144 54120 245
New

Latest on Elixir Forum

Elixir Forum

We're in Beta

About us Mission Statement