rocketmq icon indicating copy to clipboard operation
rocketmq copied to clipboard

[Bug] Producer should be retry put message if OS_PAGE_CACHE_BUSY

Open biningo opened this issue 1 year ago • 13 comments

Before Creating the Bug Report

  • [X] I found a bug, not just asking a question, which should be created in GitHub Discussions.

  • [X] I have searched the GitHub Issues and GitHub Discussions of this repository and believe that this is not a duplicate.

  • [X] I have confirmed that this bug belongs to the current repository, not other repositories of RocketMQ.

Runtime platform environment

Ubuntu 20.04

RocketMQ version

develop

JDK Version

JDK 8

Describe the Bug

If the broker is overloaded or disk IO is busy, it will clean up some expired requests and return with SYSTEM_BUSY, at which point the producer will not retry to put the message into the broker. So I think PutMessageStatus is OS_PAGE_CACHE_BUSY should also return SYSTEM_BUSY.

reference: https://github.com/apache/rocketmq/blob/develop/broker/src/main/java/org/apache/rocketmq/broker/processor/SendMessageProcessor.java#L432

Steps to Reproduce

  1. mock PutMessageStatus=OS_PAGE_CACHE_BUSY
  2. put the message into broker
  3. observe the number of produce retries

What Did You Expect to See?

The producer does not retry putting the message when the PutMessageStatus is OS_PAGE_CACHE_BUSY.

What Did You See Instead?

The producer retries putting the message when the PutMessageStatus is OS_PAGE_CACHE_BUSY.

Additional Context

No response

biningo avatar Apr 23 '24 14:04 biningo

Why can't you try again? When an MQ is busy, you can retry to send messages to other MQs.

frinda avatar Apr 24 '24 02:04 frinda

Why can't you try again? When an MQ is busy, you can retry to send messages to other MQs.

Refer to the discussion below: #5838 #1196 #2713

SYSTEM_BUSY should not retry.

biningo avatar Apr 24 '24 03:04 biningo

The community is very divided on whether SYSTEM_BUSY should be retried. But there is no retry in the latest version.

biningo avatar Apr 24 '24 08:04 biningo

From another perspective, semantically returning busy is indeed more reasonable than error.

RongtongJin avatar Apr 24 '24 08:04 RongtongJin

Generally speaking, page cache busy will only cause process write operations to be suspended for a few seconds. Retrying here will not increase the pressure on page cache synchronization reclaim, and there is no problem in retrying. But semantically speaking, it should indeed belong to SYSTEM BUSY. But this comes back to the original question. Should SYSTEM BUSY be retried? This change will cause messages that were successfully sent before because the PC was busy to be unsuccessful now.

humkum avatar Apr 24 '24 09:04 humkum

Maybe we can retry SYSTEM_BUSY by default. currently need to call producer.addRetryResponseCode(ResponseCode.SYSTEM_BUSY); to add to retry list

yuz10 avatar Apr 24 '24 09:04 yuz10

In my opinion:

  1. If the MQ is a single broker node:retry is unreasonable.
  2. If the MQ has multiple broker nodes:retry is reasonable.

And it's not possible to have only one broker in a production environment.

biningo avatar Apr 24 '24 09:04 biningo

In my opinion:

  1. If the MQ is a single broker node:retry is unreasonable.
  2. If the MQ has multiple broker nodes:retry is reasonable.

And it's not possible to have only one broker in a production environment.

agree

humkum avatar Apr 24 '24 12:04 humkum

@RongtongJin So what do you think? I think the producer can retry SYSTEM_BUSY by default. If the community agrees, I can start a new PR to fix this issue.

biningo avatar Apr 24 '24 12:04 biningo

In my opinion:

  1. If the MQ is a single broker node:retry is unreasonable.
  2. If the MQ has multiple broker nodes:retry is reasonable.

And it's not possible to have only one broker in a production environment.

We have discussed this issue countless times (like: #5838 #2726 #1196... ), and I think it is time to come to a definite conclusion. There is no doubt that we should support retries in system_busy.

Maybe we can start an email to vote for it. @RongtongJin @yuz10 @biningo

cserwen avatar Apr 28 '24 06:04 cserwen

In my opinion:

  1. If the MQ is a single broker node:retry is unreasonable.
  2. If the MQ has multiple broker nodes:retry is reasonable.

And it's not possible to have only one broker in a production environment.

We have discussed this issue countless times (like: #5838 #2726 #1196... ), and I think it is time to come to a definite conclusion. There is no doubt that we should support retries in system_busy.

Maybe we can start an email to vote for it. @RongtongJin @yuz10 @biningo

agree.

wz2cool avatar Apr 29 '24 00:04 wz2cool

Maybe we can retry SYSTEM_BUSY by default. currently need to call producer.addRetryResponseCode(ResponseCode.SYSTEM_BUSY); to add to retry list

@biningo Currently, you can try this to solve your problem.

wz2cool avatar Apr 29 '24 00:04 wz2cool

#5845 already merged. So I changed the issue title.

biningo avatar May 11 '24 15:05 biningo