Skip to content

Prevent deadlock#200

Merged
spuun merged 1 commit intomainfrom
bugfix-semi-deadlock
Mar 17, 2025
Merged

Prevent deadlock#200
spuun merged 1 commit intomainfrom
bugfix-semi-deadlock

Conversation

@spuun
Copy link
Copy Markdown
Member

@spuun spuun commented Mar 13, 2025

I'm not entirely sure how this happened, but I managed to get a deadlock when running lavinmqperf throughput against lavinmq via amqproxy. I couldn't reproduce with rabbitmq, but maybe it can happen with rabbitmq too (#198 could be the same problem).

What I think happened is that one fiber in lavinmq held a lock while trying to write to a blocked socket (full buffer?), while the same happened for a fiber holding both the socket lock and the channels lock in Upstream. By moving the send call to outside the channels lock other fibers in amqproxy could continue to operate and things moved.

I know, very vauge description of the problem, but that's because I couldn't really wrap my head around it.

I had to run lavinmqperf with multiple publishers and consumers (-x 5 -y 5) for it to happen, so I guess high throughput and multiple fibers had to be involved.

@spuun spuun requested a review from a team as a code owner March 13, 2025 19:19
Copy link
Copy Markdown
Member

@baelter baelter left a comment

Choose a reason for hiding this comment

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

The change makes sense without full head-wrapping achieved.

@spuun spuun merged commit 9c31483 into main Mar 17, 2025
@spuun spuun deleted the bugfix-semi-deadlock branch March 17, 2025 06:55
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.

3 participants