henrypoter opened a new issue #1671: what is the rightway to use producer send async messages URL: https://github.com/apache/rocketmq/issues/1671 1. Please describe the issue you observed: - What did you do (The steps to reproduce)? I use producer to send async messages in a loop, there is only one thread call producer async send, the code is as follows: while(true){ producer.send(msg,callback,30000L) } for a while, the following exceptions occured: `org.apache.rocketmq.client.exception.MQClientException: executor rejected For more information, please visit the url, http://rocketmq.apache.org/docs/faq/ at org.apache.rocketmq.client.impl.producer.DefaultMQProducerImpl.send(DefaultMQProducerImpl.java:522) at org.apache.rocketmq.client.producer.DefaultMQProducer.send(DefaultMQProducer.java:382) at org.apache.rocketmq.example.tracemessage.TraceProducer.main(TraceProducer.java:45) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134) Caused by: java.util.concurrent.RejectedExecutionException: Task java.util.concurrent.FutureTask@46b7c89b rejected from java.util.concurrent.ThreadPoolExecutor@57536d79[Running, pool size = 8, active threads = 8, queued tasks = 50000, completed tasks = 0] at java.util.concurrent.ThreadPoolExecutor$AbortPolicy.rejectedExecution(ThreadPoolExecutor.java:2047) at java.util.concurrent.ThreadPoolExecutor.reject(ThreadPoolExecutor.java:823) at java.util.concurrent.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:1369) at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:112) at org.apache.rocketmq.client.impl.producer.DefaultMQProducerImpl.send(DefaultMQProducerImpl.java:504) ... 7 more org.apache.rocketmq.client.exception.MQClientException: executor rejected ` `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:569) at org.apache.rocketmq.remoting.netty.ResponseFuture.executeInvokeCallback(ResponseFuture.java:54) at org.apache.rocketmq.remoting.netty.NettyRemotingAbstract$2.run(NettyRemotingAbstract.java:309) 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:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) org.apache.rocketmq.client.exception.MQClientException: wait response timeout 0ms` - What did you expect to see? From the rocketmq source code, I found that the defaultAsyncSenderExecutor only support 5w requests in the queue. So if the broker can not process the msgs as quickly as the producer send, the defaultAsyncSenderExecutor will reject request when the defaultAsyncSenderExecutor full. My questions are : What is the right way to use the producer to send msg async? Should I control the frequency when send a async msg? If so, what is the recommend frequency to send async? 2. Please tell us about your environment: 4core +4G rocketmq 4.6.0 3. Other information (e.g. detailed explanation, logs, related issues, suggestions how to fix, etc):
---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services
