You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@rocketmq.apache.org by GitBox <gi...@apache.org> on 2021/10/29 13:16:27 UTC

[GitHub] [rocketmq-client-go] HYY-yu opened a new issue #736: [Master] If a broker down, There will be problems with the retry strategy for a while

HYY-yu opened a new issue #736:
URL: https://github.com/apache/rocketmq-client-go/issues/736


   Hello, I found that there may be a problem with the retry strategy when we use the default configuration of the Producer.
   
   **BUG REPORT**  
   1. Please describe the issue you observed:
   
       - What did you do (The steps to reproduce)?     
     
   frist we got a producer:   
   ```golang
           p, _ := rocketmq.NewProducer(
   		producer.WithNsResolver(primitive.NewPassthroughResolver([]string{"127.0.0.1:9876"})),
   		producer.WithRetry(3),
   	)
           // do something with p
   ```
   as we know, the producer has default configuration :   
   ```
         1. _PullNameServerInterval = 30 * time.Second
         2. Selector:  NewRoundRobinQueueSelector()
   ```
   and we send some messages to Topic (test): 
   ```golang
           topic := "test"
   	for i := 0; i < 10; i++ {
   		msg := &primitive.Message{
   			Topic: topic,
   			Body:  []byte("Hello RocketMQ Go Client! " + strconv.Itoa(i)),
   		}
   		res, err := p.SendSync(context.Background(), msg)
   
   		if err != nil {
   			fmt.Printf("send message error: %s\n", err)
   		} else {
   			fmt.Printf("send message success: result=%s\n", res.String())
   		}
   	}
   ```
   In rocketmq server side, We have a 2m-2s-sync cluster, And the topic (test) has 4 message queue.
   
   [![5vky2F.png](https://z3.ax1x.com/2021/10/29/5vky2F.png)](https://imgtu.com/i/5vky2F)
   
   Producer will send messages to each MessageQueue through the RoundRobin strategy, but if brokerA crashes, and the number of retry is less than the number of queues. The message will fail to send and return a connection refused error.
   
   ```golang
   		res, err := p.SendSync(context.Background(), msg)
   		if err != nil {
                            // returned the connection refused.
   			fmt.Printf("send message error: %s\n", err)
   		}
   	}
   ```
   
       - What did you expect to see?
   
   We should be able to handle this exception automatically instead of returning an error.
   Because many people use the default configuration, there are three retries and at least four MessageQueues. If the broker crashes, they will receive a large number of connection rejection errors within a maximum of 30 seconds (the default refresh time).
   
   3. Other information (e.g. detailed explanation, logs, related issues, suggestions on how to fix, etc):
   
   I think there are two ways to solve it: 
   
   1. Tell people that the number of retries must be greater than the number of MessageQueue, but I think this is not a good idea.    
   2. I can implement a QueueSelector, it will traverse each Broker one by one, access their queues in turn, 
   avoid retry strategies concentrated on a single broker, If feasible, I will submit a PR.
   
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [rocketmq-client-go] syncwt commented on issue #736: [Master] If a broker down, There will be problems with the retry strategy for a while

Posted by GitBox <gi...@apache.org>.
syncwt commented on issue #736:
URL: https://github.com/apache/rocketmq-client-go/issues/736#issuecomment-998565539


   Same Issue with  #730 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [rocketmq-client-go] HYY-yu commented on issue #736: [Master] If a broker down, There will be problems with the retry strategy for a while

Posted by GitBox <gi...@apache.org>.
HYY-yu commented on issue #736:
URL: https://github.com/apache/rocketmq-client-go/issues/736#issuecomment-962750250


   看到rocketmq的文档中有写:
   [https://github.com/apache/rocketmq/blob/master/docs/cn/best_practice.md](best_practice)
   
   ```
   1.2 消息发送失败处理方式
   Producer的send方法本身支持内部重试,重试逻辑如下:
   
   - 至多重试2次。
   - 如果同步模式发送失败,则轮转到下一个Broker,如果...
   ```
   
   所以内部的重试逻辑应该是要考虑broker的切换的。


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [rocketmq-client-go] syncwt removed a comment on issue #736: [Master] If a broker down, There will be problems with the retry strategy for a while

Posted by GitBox <gi...@apache.org>.
syncwt removed a comment on issue #736:
URL: https://github.com/apache/rocketmq-client-go/issues/736#issuecomment-998565539


   Same Issue with  #730 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org