apache / rocketmq

Apache RocketMQ is a cloud native messaging and streaming platform, making it simple to build event-driven applications.
https://rocketmq.apache.org/
Apache License 2.0
21.19k stars 11.67k forks source link

wait response timeout 0ms #2287

Closed bitoceango closed 2 years ago

bitoceango commented 4 years ago

hello,Can someone help me? When I producer message to Broker fast,i get below exception:

org.apache.rocketmq.client.exception.MQClientException: wait response timeout 0ms
For more information, please visit the url, http://rocketmq.apache.org/docs/faq/
  at org.apache.rocketmq.client.impl.MQClientAPIImpl$1.operationComplete(MQClientAPIImpl.java:416)
  at org.apache.rocketmq.remoting.netty.ResponseFuture.executeInvokeCallback(ResponseFuture.java:51)
  at org.apache.rocketmq.remoting.netty.NettyRemotingAbstract$2.run(NettyRemotingAbstract.java:286)
  at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
  at java.util.concurrent.FutureTask.run(FutureTask.java:266)
  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
  at java.lang.Thread.run(Thread.java:748)

I read the source code, but did not find the reason, why is the timeout 0ms? I did not set the timeout time separately, the timeout time should be the default 3000ms.

my producer config is :

public class MessageProducer  {
    private DefaultMQProducer producer = new DefaultMQProducer();
    public MessageProducer() {
        producer.setNamesrvAddr("xxxxxx");
        producer.setProducerGroup("yxshi-request-copy-Group");
        try {
            producer.start();
            log.info("mq producer start success");
        } catch (MQClientException e) {
            log.error("", e);
        }
        producer.setRetryTimesWhenSendAsyncFailed(1);
    }
    public void send( Message message) {
        try {
               producer.send(message, new SendCallback() {
                @Override
                public void onSuccess(SendResult sendResult) {
                    log.info("消息发送成功,{}", sendResult);
                }
                @Override
                public void onException(Throwable e) {
                    log.error("消息发送失败,{}", e);
                }
            });
        } catch (Exception e) {
            log.error("消息发送失败", e);
        }
    }
    @PreDestroy
    public  void shutdown()throws Exception{
        producer.shutdown();
    }
}

Can anyone give some advice?thanks

francisoliverlee commented 4 years ago

@tiyxing can u do it recurrence always and how many clusters with different namesrvs ?

bitoceango commented 4 years ago

This exception does not necessarily occur

i have three namesrvs: 172.21.x.x:9876;rocketmq-nameserver-01:9876;rocketmq-nameserver-02:9876

my topic config 6 broker and every broker has 16 queue

when i config every broker 32 queue,the exception disappeared

So I still don’t know why

francisoliverlee commented 4 years ago

can u show your broker config

bitoceango commented 4 years ago

my broker config

##################################### brokerClusterName=rocketmq-cluster-ptest brokerName=broker-16 brokerId=0 namesrvAddr=xxxx defaultTopicQueueNums=4 autoCreateTopicEnable=false autoCreateSubscriptionGroup=true listenPort=10911 deleteWhen=04 fileReservedTime=168 mapedFileSizeCommitLog=1073741824

mapedFileSizeConsumeQueue=300000

mappedFileSizeConsumeQueue=300000

destroyMapedFileIntervalForcibly=120000

redeleteHangedFileInterval=120000

diskMaxUsedSpaceRatio=88 storePathRootDir=xxx storePathCommitLog=xxx storePathConsumeQueue=xxxx storePathIndex=xxxx storeCheckpoint=xxxx abortFile=xxxxx maxMessageSize=1048576

flushCommitLogLeastPages=4

flushConsumeQueueLeastPages=2

flushCommitLogThoroughInterval=10000

flushConsumeQueueThoroughInterval=60000

ASYNC_MASTER brokerRole=ASYNC_MASTER

flushDiskType=ASYNC_FLUSH

checkTransactionMessageEnable=false

sendMessageThreadPoolNums=128

pullMessageThreadPoolNums=128

sendThreadPoolQueueCapacity = 100000 waitTimeMillsInSendQueue = 2000 osPageCacheBusyTimeOutMills=2000

transientStorePoolEnable=False

transientStorePoolEnable=True transientStorePoolSize=5

slaveReadEnable =true

deleteCommitLogFilesInterval = 100 deleteConsumeQueueFilesInterval=100

lomoye commented 3 years ago

4.3以后超时时间是动态算的了(每次会减掉中间代码的消耗时间),建议看一下源码

github-actions[bot] commented 2 years ago

This issue is stale because it has been open for 365 days with no activity. It will be closed in 3 days if no further activity occurs.

github-actions[bot] commented 2 years ago

This issue was closed because it has been inactive for 3 days since being marked as stale.