Skip to content

[fix] Resume consumer after netty channel writable change - #1944

Merged
Technoboy- merged 1 commit into
masterfrom
gaoran/fix-channel-writability-changed
Oct 29, 2026
Merged

Technoboy- merged 1 commit into
masterfrom
gaoran/fix-channel-writability-changed

Conversation

@gaoran10

@gaoran10 gaoran10 commented Oct 28, 2026 •

Copy link
Copy Markdown
Collaborator

Motivation

Shared consumers can stall after the AMQP connection becomes unwritable. Pulsar’s updated dispatcher waits for a writability notification to resume reads, but AoP’s connection handler did not forward that notification to its consumers.

Modifications

Resume dispatch when the AMQP connection becomes writable again, without adding consumer credit. Schedule the wakeup asynchronously and recheck that the connection is active and writable before notifying subscriptions.

Add a regression test that forces the connection unwritable, waits for dispatch to stop, then restores writability and verifies that queued messages are delivered.

Documentation

Check the box below.

Need to update docs?

  • doc-required

    (If you need help on updating docs, create a doc issue)

  • no-need-doc

    (Please explain why)

  • doc

    (If this PR contains doc changes)

@github-actions

Copy link
Copy Markdown

@gaoran10:Thanks for your contribution. For this PR, do we need to update docs?
(The PR template contains info about doc, which helps others know more about the changes. Can you provide doc-related info in this and future PR descriptions? Thanks)

@github-actions github-actions Bot added doc-info-missing This pr needs to mark a document option in description and removed doc-info-missing This pr needs to mark a document option in description labels Oct 28, 2026
@github-actions

Copy link
Copy Markdown

@gaoran10:Thanks for providing doc info!

@github-actions github-actions Bot added the no-need-doc This pr does not need any document label Oct 28, 2026
@gaoran10
gaoran10 requested a balanced review from Copilot October 29, 2026 04:04

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟢 Approval recommended

No active review issues are reported for the changes intended to resume stalled AMQP consumer delivery when connections become writable.

No open issues 🎉

What changed in this PR

This PR addresses stalled shared consumers by notifying their subscriptions when an AMQP connection becomes writable again.

Changes:

  • Schedule dispatch wakeups asynchronously, rechecking connection activity and writability without adding consumer credit.
  • Add a regression test that forces unwritability and verifies queued messages resume delivery exactly once.
  • Remove the decoder’s logging-only writability handler, explicit decoder getter, and related documentation workaround.
File Description
tests/​src/​test/​java/​io/​streamnative/​pulsar/​handlers/​amqp/​rabbitmq/​RabbitMQMessagingTest.java Tests delivery resumption after connection writability is restored.
amqp-impl/​src/​test/​java/​io/​streamnative/​pulsar/​handlers/​amqp/​test/​AmqpProtocolTestBase.java Removes the decoder-access workaround from a comment.
amqp-impl/​src/​main/​java/​io/​streamnative/​pulsar/​handlers/​amqp/​AmqpConnection.java Adds deferred subscription notifications when the connection becomes writable.
amqp-impl/​src/​main/​java/​io/​streamnative/​pulsar/​handlers/​amqp/​AmqpCommandDecoder.java Removes the logging-only writability override and explicit decoder getter.

Review effort: Balanced

@Technoboy-
Technoboy- merged commit e72d982 into master Oct 29, 2026
8 checks passed
@Technoboy-
Technoboy- deleted the gaoran/fix-channel-writability-changed branch October 29, 2026 04:51
gaoran10 added a commit that referenced this pull request Oct 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants