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

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.

woylie

woylie

In case someone else stumbles upon this thread: The documentation of the amqp library has an example which sets the fail_if_no_peer_cert to true (AMQP.Connection — amqp v3.3.0)). Starting with OTP 26, setting this option on the client side will result in the error {:error, {:option, :server_only, :fail_if_no_peer_cert}}. See Erlang/OTP 26 Highlights - Erlang/OTP.

Where Next?

Popular in Questions Top

Brian
What is the proper way to load a module from a file in to IEX? In the python world, doing something like this pretty standard: from ....
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
yawaramin
In the Dialyzer docs ( http://erlang.org/doc/man/dialyzer.html#requesting-or-suppressing-warnings-in-source-files ), there is a way to tu...
New
itssasanka
Hi all, Trying to get some more clarity over utc_datetime and naive_datetime for Ecto: https://hexdocs.pm/ecto/Ecto.Schema.html#module-...
New
SoCreat
i’m a new one to elixir which editor can i use vs code? or atom? Thanks! :smiley:
New
LegitStack
I’m trying to make a websocket server in Phoenix or raw Elixir. I heard about gun, I think I could use cowboy, but since I’m not that sma...
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 Postg...
New
electic
Hi, I am new to Elixir. I am trying to use the DateTime component to insert a date into MySQL however the there seems to be no way to fo...
New
Patoshizzle
After calling mix ecto.create I get this error: 17:00:32.162 [error] GenServer #PID&lt;0.412.0&gt; terminating ** (Postgrex.Error) FATAL...
New
belgoros
I’m not a pro in using Regex and can’t figure out why the following behaviour happens, especially if we take into account the difference ...
New

Other popular topics Top

jerry
Good day to you all. I have been struggling to get a query involving like and ilike to work. Can anyone assist me on this, please? pro...
New
KronicDeth
Elixir plugin for JetBrain’s IntelliJ Platform (including Rubymine) This is a plugin that adds support for Elixir to JetBrains IntelliJ...
289 35421 110
New
polypush135
As many of you may have realized by now (sorry for all the posts here) I’ve been working on a db problem where I’m trying to aggregate a ...
New
nsuchy
Hi. I’ve noticed that Windows Powershell has it’s own IEX command and you cannot access Elixir’s IEX due to the conflict. This isn’t a cr...
New
myronmarston
The Elixir Typespec docs show the following syntax for keyword lists in typespecs: # ... | [key: type] # keyword lis...
New
ashish173
I am using Ecto timestamps with postgres, I can see the timestamps() use the :naive_dateime but for my use case I wanted to store the ti...
New
qwerescape
Is there a way to get the call stack or stack trace at any point in the code? Not from exceptions, but an expression that returns how the...
New
stefanluptak
Hello everybody, usually, I use a 29" ultra-wide monitor for VSCode which can easily accomodate explorer (files panel) + file with code ...
New
AstonJ
We’ve put together this wiki for Phoenix LiveView - please feel free to add any info you feel is worth including. What is Phoenix LiveV...
New
AstonJ
by Lance Halvorsen Elixir and Phoenix are generating tremendous excitement as an unbeatable platform for building modern web application...
460 27162 124
New

We're in Beta

About us Mission Statement