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

fix(heartbeat): stop heartbeat if connection is not active #403

Merged
merged 2 commits into from
Apr 23, 2024

Conversation

slavik-pastushenko
Copy link
Contributor

@slavik-pastushenko slavik-pastushenko commented Apr 22, 2024

Fixed #401

If you stop your RabbitMQ cluster with a grace period 0, it will still say it is connected.

By sending a readable event it returns:

2024-04-22T16:23:32.570945Z ERROR Socket was readable but we read 0. This usually means that the connection is half closed which marks it as broken.

@Keruspe
Copy link
Collaborator

Keruspe commented Apr 22, 2024

We shouldn't emit a readable event ourselves, it really should come from the socket itself.

It can be a good lead for investigation though (and I have plan for an overhaul of all of this btw).

Do you use TLS or plain tcp ?

@slavik-pastushenko
Copy link
Contributor Author

We shouldn't emit a readable event ourselves, it really should come from the socket itself.

It can be a good lead for investigation though (and I have plan for an overhaul of all of this btw).

Do you use TLS or plain tcp ?

plain TCP, lemme update the pr

@slavik-pastushenko slavik-pastushenko marked this pull request as draft April 22, 2024 20:09
Keruspe added a commit that referenced this pull request Apr 22, 2024
Keruspe added a commit that referenced this pull request Apr 22, 2024
@slavik-pastushenko slavik-pastushenko marked this pull request as ready for review April 22, 2024 21:56
@slavik-pastushenko
Copy link
Contributor Author

@Keruspe PR is updated.

@Keruspe
Copy link
Collaborator

Keruspe commented Apr 23, 2024

I like that last commit. When dumping #404 and letting it rest in my head I thought of something similar.

There's a couple of things that should be updated though.

I think we should have a dedicated error for this.

The check should be done at the very beginning of the self.timeout.map block, we should use cancel there and return None. We should check for 4*timeout (see comment in #404)

src/io_loop.rs Outdated Show resolved Hide resolved
src/io_loop.rs Show resolved Hide resolved
src/heartbeat.rs Outdated Show resolved Hide resolved
Copy link
Collaborator

@Keruspe Keruspe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly LGTM, will fixup a couple of cosmetic stuff and issue a release

@Keruspe Keruspe merged commit 13f0821 into amqp-rs:main Apr 23, 2024
8 checks passed
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 this pull request may close these issues.

heartbeat is sent even after io loop panicked
2 participants