Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No reconnection attempts after connection timeout #118

Closed
haraldpdl opened this issue Jun 20, 2023 · 5 comments · Fixed by #128
Closed

No reconnection attempts after connection timeout #118

haraldpdl opened this issue Jun 20, 2023 · 5 comments · Fixed by #128

Comments

@haraldpdl
Copy link

AMQProxy 0.8.8

If the connection cuts out, no reconnection attempts are performed. Systemd shows the service as "active (running)" with the following being logged in the journal:

Error reading from upstream: Error reading socket: Connection timed out (IO::Error)
from usr/share/crystal/src/io/evented.cr:61:9 in 'unbuffered_read'
from usr/share/crystal/src/io/buffered.cr:261:5 in 'fill_buffer'
from usr/share/crystal/src/io/buffered.cr:83:9 in 'read'
from usr/share/crystal/src/io.cr:540:20 in 'read_fully?'
from usr/share/crystal/src/io.cr:523:5 in 'read_fully'
from tmp/amqproxy/lib/amq-protocol/src/amq/protocol/frames.cr:26:9 in 'read_loop'
from tmp/amqproxy/src/amqproxy/upstream.cr:34:7 in '->'
from usr/share/crystal/src/fiber.cr:146:11 in 'run'
from usr/share/crystal/src/fiber.cr:98:34 in '->'
from ???

It would be great if reconnection attempts can be performed or if the service could abort so Systemd can retry to start the service again.

Thanks in advance!

@haraldpdl
Copy link
Author

Extra information:

OS: Debian 11

Package installed Systemd Service File: /lib/systemd/system/amqproxy.service

[Unit]
Description=AMQProxy server for connection and channel pooling
Documentation=https://github.com/cloudamqp/amqproxy
Requires=network.target
After=network.target

[Service]
ExecStart=/usr/bin/amqproxy --config /etc/amqproxy.ini
Restart=on-failure
DynamicUser=yes
LimitNOFILE=infinity

[Install]
WantedBy=multi-user.target

Changing Restart to the following:

[Service]
Restart=always

does not unfortunately fix the issue.

@TristanPouliquen
Copy link

Hi,

We are also facing this issue with the newest v0.8.12.

This makes our PHP processes wait indefinitely on a get call to a connection that does not exist anymore => our message processing stops working, and our processes continue running indefinitely.

OS : Ubuntu 20.04
AMQProxy: 0.8.12
PHP: 8.0

@dentarg
Copy link
Member

dentarg commented Sep 26, 2023

amqproxy will connect to the broker if you connect to it again, are you saying that is not the case? I think you need to check your clients

@TristanPouliquen
Copy link

If the connection is closed by the server, the socket stays open so our PHP processes do not see that the connection is not open anymore, and will indefinitely wait on a response from the AMQP server : php-amqp/php-amqp#35

@dentarg
Copy link
Member

dentarg commented Oct 2, 2023

Yeah I have been able to reproduce this – I hope to have a PR addressing it out this week

dentarg added a commit that referenced this issue Oct 3, 2023
This change also removes the code added in #104

The motivation behind that is

* IO:_Error that happens in Upstream#connect is raised as Upstream::Error
* IO::Error that happens in Upstream#read_loop is rescued in that method
* IO::Error that happens in Client#read_loop is raised as Client::Error

Adds an integration test with the php-amqp client run via Docker Compose
and Toxiproxy.

Close #118
Close #111
Close #98
dentarg added a commit that referenced this issue Oct 11, 2023
This change also removes the code added in #104

The motivation behind that is

* IO:_Error that happens in Upstream#connect is raised as Upstream::Error
* IO::Error that happens in Upstream#read_loop is rescued in that method
* IO::Error that happens in Client#read_loop is raised as Client::Error

Adds an integration test with the php-amqp client run via Docker Compose
and Toxiproxy.

Close #118
Close #111
Close #98
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants