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 2020/04/09 02:06:20 UTC
[GitHub] [rocketmq] lionhuo opened a new issue #1923: 异步发送消息,消息丢失问题
lionhuo opened a new issue #1923: 异步发送消息,消息丢失问题
URL: https://github.com/apache/rocketmq/issues/1923
版本: 4.6.1
OS: Centos
部署方式:一主一从
问题描述:
采用DefaultMQProducer的异步发送方式,client端执行完send后,broker端无该消息的任何信息,本地也无任何响应回调,当时broker服务器上的cpu和内存也正常,查看了client,remoting,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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [rocketmq] xiangwangcheng commented on issue #1923: 异步发送消息,消息丢失问题
Posted by GitBox <gi...@apache.org>.
xiangwangcheng commented on issue #1923: 异步发送消息,消息丢失问题
URL: https://github.com/apache/rocketmq/issues/1923#issuecomment-611383622
Could you please paste some more info like the code of client-side, broker.log?
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [rocketmq] rushsky518 commented on issue #1923: 异步发送消息,消息丢失问题
Posted by GitBox <gi...@apache.org>.
rushsky518 commented on issue #1923: 异步发送消息,消息丢失问题
URL: https://github.com/apache/rocketmq/issues/1923#issuecomment-611445971
producer.setNamespace(namesrvAddr);
这个参数配置错了,你想配置的可能是 nameserver 地址?
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [rocketmq] lionhuo commented on issue #1923: 异步发送消息,消息丢失问题
Posted by GitBox <gi...@apache.org>.
lionhuo commented on issue #1923: 异步发送消息,消息丢失问题
URL: https://github.com/apache/rocketmq/issues/1923#issuecomment-611454615
我再看看源码,深入了解下,非常感谢
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [rocketmq] lionhuo commented on issue #1923: 异步发送消息,消息丢失问题
Posted by GitBox <gi...@apache.org>.
lionhuo commented on issue #1923: 异步发送消息,消息丢失问题
URL: https://github.com/apache/rocketmq/issues/1923#issuecomment-611392969
this is the producer code
`@PostConstruct
public void init(){
producer = new DefaultMQProducer("PRODUCER_GROUP");
producer.setNamespace(namesrvAddr);
producer.setRetryTimesWhenSendAsyncFailed(3);
try {
producer.start();
} catch (MQClientException e) {
logger.error("========> errMsg:{}", e.getMessage(), e);
}
logger.info("--------> producer group:PRODUCER_GROUP");
}
public void sendJobInfo(TaServer taServer, JobInfoVO jobInfoVO, short sendType){
try{
logger.info("--------> send job info, ta:{}, job id:{}, send type:{}", taServer.getName(), jobInfoVO.getJob().getId(), sendType);
JSONObject msgObj = new JSONObject();
msgObj.put("jobInfo", jobInfoVO);
msgObj.put("sendType", sendType);
String msgObjJson = JSONObject.toJSONString(msgObj);
Message msg = new Message("REQUEST_TOPIC" /* Topic */,
taServer.getFqdn()/*Tag*/,
new StringBuilder("job-req-").append(jobInfoVO.getJob().getId()).append("-").append(sendType).toString(), /*key e.g. job-req-1000-2*/
msgObjJson.getBytes(RemotingHelper.DEFAULT_CHARSET) /* Message body */
);
producer.send(msg, new SendCallback() {
@Override
public void onSuccess(SendResult sendResult) {
logger.info("-------->send job info success:{}", sendResult);
}
@Override
public void onException(Throwable throwable) {
logger.info("-------->send job info error:{}", throwable.getMessage());
}
});
} catch (Exception e) {
logger.error("========> send job info failed, errMsg:{}", e.getMessage(), e);
}
}`
[producer log]
2020-04-03 05:14:20,529 [scheduler-7] INFO --------> send job info, ta:xxxxxx, job id:267374, send type:2
2020-04-03 05:14:20,620 [scheduler-7] INFO - --------> send job info, ta:xxxxxx, job id:267375, send type:2
[broker log]
2020-04-03 05:14:06 INFO brokerOutApi_thread_3 - register broker[0]to name server xxxxxx:9876 OK
2020-04-03 05:14:12 INFO brokerOutApi_thread_1 - register broker[1]to name server xxxxxx:9876 OK
2020-04-03 05:14:15 INFO BrokerControllerScheduledThread1 - Update slave consumer offset from master, xxxxxx:10911
2020-04-03 05:14:15 INFO BrokerControllerScheduledThread1 - Update slave delay offset from master, xxxxxx:10911
2020-04-03 05:14:25 INFO BrokerControllerScheduledThread1 - Update slave consumer offset from master, xxxxxx:10911
2020-04-03 05:14:25 INFO BrokerControllerScheduledThread1 - Update slave delay offset from master, xxxxxx:10911
2020-04-03 05:14:35 INFO BrokerControllerScheduledThread1 - Update slave consumer offset from master, xxxxxx:10911
2020-04-03 05:14:35 INFO BrokerControllerScheduledThread1 - Update slave delay offset from master, xxxxxx:10911
2020-04-03 05:14:36 INFO BrokerControllerScheduledThread1 - dispatch behind commit log 0 bytes
2020-04-03 05:14:36 INFO BrokerControllerScheduledThread1 - Slave fall behind master: 0 bytes
2020-04-03 05:14:36 INFO brokerOutApi_thread_4 - register broker[0]to name server xxxxxx:9876 OK
2020-04-03 05:14:42 INFO BrokerControllerScheduledThread1 - dispatch behind commit log 0 bytes
2020-04-03 05:14:42 INFO brokerOutApi_thread_2 - register broker[1]to name server xxxxxx:9876 OK
it's the producer client log and broker log at that time, then has no response includes success or failed,
i can not find this message on the broker also.
the client sends about more 100 msgs and just losts these two.
this JVM includes more than one producer which has the same instanceName, it has a problem?
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [rocketmq] lionhuo commented on issue #1923: 异步发送消息,消息丢失问题
Posted by GitBox <gi...@apache.org>.
lionhuo commented on issue #1923: 异步发送消息,消息丢失问题
URL: https://github.com/apache/rocketmq/issues/1923#issuecomment-611447026
这里确实配置错了,但是为什么也能正常工作呢?
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [rocketmq] lionhuo edited a comment on issue #1923: 异步发送消息,消息丢失问题
Posted by GitBox <gi...@apache.org>.
lionhuo edited a comment on issue #1923: 异步发送消息,消息丢失问题
URL: https://github.com/apache/rocketmq/issues/1923#issuecomment-611450049
感谢,我对这个了解的不够深入,但目前99%的消息都可以正常发送,错误日志也没有任何提示,所以一直没有找到原因,在控制台也确实找到了注册的producer,也就是说这个配置会引起我上面这种未知的异常吗?
![1586427180(1)](https://user-images.githubusercontent.com/3981349/78885021-74199600-7a8e-11ea-858c-8c798a6e78c7.jpg)
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [rocketmq] lionhuo commented on issue #1923: 异步发送消息,消息丢失问题
Posted by GitBox <gi...@apache.org>.
lionhuo commented on issue #1923: 异步发送消息,消息丢失问题
URL: https://github.com/apache/rocketmq/issues/1923#issuecomment-611450049
感谢,我对这个了解的不够深入,但目前99%的消息都可以正常发送,错误日志也没有任何提示,所以一直没有找到原因,在控制台也确实找到了注册的producer,也就是说这个配置会引起我上面这种未知的异常吗?
![image](https://user-images.githubusercontent.com/3981349/78884789-16854980-7a8e-11ea-85f0-b1b6a8ac5fcc.png)
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [rocketmq] rushsky518 commented on issue #1923: 异步发送消息,消息丢失问题
Posted by GitBox <gi...@apache.org>.
rushsky518 commented on issue #1923: 异步发送消息,消息丢失问题
URL: https://github.com/apache/rocketmq/issues/1923#issuecomment-611446448
producer.setNamespace(namesrvAddr);
这个参数配置错了,你想配置的可能是 nameserver 地址?
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [rocketmq] rushsky518 commented on issue #1923: 异步发送消息,消息丢失问题
Posted by GitBox <gi...@apache.org>.
rushsky518 commented on issue #1923: 异步发送消息,消息丢失问题
URL: https://github.com/apache/rocketmq/issues/1923#issuecomment-611448185
这不叫能正常工作,可能是你没发现错误日志。另:namespace 是用来做隔离的
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [rocketmq] lionhuo closed issue #1923: 异步发送消息,消息丢失问题
Posted by GitBox <gi...@apache.org>.
lionhuo closed issue #1923: 异步发送消息,消息丢失问题
URL: https://github.com/apache/rocketmq/issues/1923
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [rocketmq] rushsky518 removed a comment on issue #1923: 异步发送消息,消息丢失问题
Posted by GitBox <gi...@apache.org>.
rushsky518 removed a comment on issue #1923: 异步发送消息,消息丢失问题
URL: https://github.com/apache/rocketmq/issues/1923#issuecomment-611446448
producer.setNamespace(namesrvAddr);
这个参数配置错了,你想配置的可能是 nameserver 地址?
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [rocketmq] lionhuo edited a comment on issue #1923: 异步发送消息,消息丢失问题
Posted by GitBox <gi...@apache.org>.
lionhuo edited a comment on issue #1923: 异步发送消息,消息丢失问题
URL: https://github.com/apache/rocketmq/issues/1923#issuecomment-611450049
感谢,我对这个了解的不够深入,但目前99%的消息都可以正常发送,错误日志也没有任何提示,所以一直没有找到原因,在控制台也确实找到了注册的producer,也就是说这个配置会引起我上面这种未知的异常吗?
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [rocketmq] rushsky518 commented on issue #1923: 异步发送消息,消息丢失问题
Posted by GitBox <gi...@apache.org>.
rushsky518 commented on issue #1923: 异步发送消息,消息丢失问题
URL: https://github.com/apache/rocketmq/issues/1923#issuecomment-611465708
1. 要指定正确的 nameserver 地址,否则从 http://jmenv.tbsite.net:8080/rocketmq/nsaddr 得到 nameserver 地址。
2. 如果 producer 设置了 namespace,consumer 拉取消息时,也要设置对应的 namespace
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [rocketmq] lionhuo edited a comment on issue #1923: 异步发送消息,消息丢失问题
Posted by GitBox <gi...@apache.org>.
lionhuo edited a comment on issue #1923: 异步发送消息,消息丢失问题
URL: https://github.com/apache/rocketmq/issues/1923#issuecomment-611392969
this is the producer code
```
@PostConstruct
public void init(){
producer = new DefaultMQProducer("PRODUCER_GROUP");
producer.setNamespace(namesrvAddr);
producer.setRetryTimesWhenSendAsyncFailed(3);
try {
producer.start();
} catch (MQClientException e) {
logger.error("========> errMsg:{}", e.getMessage(), e);
}
logger.info("--------> producer group:PRODUCER_GROUP");
}
```
```
public void sendJobInfo(TaServer taServer, JobInfoVO jobInfoVO, short sendType){
try{
logger.info("--------> send job info, ta:{}, job id:{}, send type:{}", taServer.getName(), jobInfoVO.getJob().getId(), sendType);
JSONObject msgObj = new JSONObject();
msgObj.put("jobInfo", jobInfoVO);
msgObj.put("sendType", sendType);
String msgObjJson = JSONObject.toJSONString(msgObj);
Message msg = new Message("REQUEST_TOPIC" /* Topic */,
taServer.getFqdn()/*Tag*/,
new StringBuilder("job-req-").append(jobInfoVO.getJob().getId()).append("-").append(sendType).toString(), /*key e.g. job-req-1000-2*/
msgObjJson.getBytes(RemotingHelper.DEFAULT_CHARSET) /* Message body */
);
producer.send(msg, new SendCallback() {
@Override
public void onSuccess(SendResult sendResult) {
logger.info("-------->send job info success:{}", sendResult);
}
@Override
public void onException(Throwable throwable) {
logger.info("-------->send job info error:{}", throwable.getMessage());
}
});
} catch (Exception e) {
logger.error("========> send job info failed, errMsg:{}", e.getMessage(), e);
}
}
```
[producer log]
2020-04-03 05:14:20,529 [scheduler-7] INFO --------> send job info, ta:xxxxxx, job id:267374, send type:2
2020-04-03 05:14:20,620 [scheduler-7] INFO - --------> send job info, ta:xxxxxx, job id:267375, send type:2
[broker log]
2020-04-03 05:14:06 INFO brokerOutApi_thread_3 - register broker[0]to name server xxxxxx:9876 OK
2020-04-03 05:14:12 INFO brokerOutApi_thread_1 - register broker[1]to name server xxxxxx:9876 OK
2020-04-03 05:14:15 INFO BrokerControllerScheduledThread1 - Update slave consumer offset from master, xxxxxx:10911
2020-04-03 05:14:15 INFO BrokerControllerScheduledThread1 - Update slave delay offset from master, xxxxxx:10911
2020-04-03 05:14:25 INFO BrokerControllerScheduledThread1 - Update slave consumer offset from master, xxxxxx:10911
2020-04-03 05:14:25 INFO BrokerControllerScheduledThread1 - Update slave delay offset from master, xxxxxx:10911
2020-04-03 05:14:35 INFO BrokerControllerScheduledThread1 - Update slave consumer offset from master, xxxxxx:10911
2020-04-03 05:14:35 INFO BrokerControllerScheduledThread1 - Update slave delay offset from master, xxxxxx:10911
2020-04-03 05:14:36 INFO BrokerControllerScheduledThread1 - dispatch behind commit log 0 bytes
2020-04-03 05:14:36 INFO BrokerControllerScheduledThread1 - Slave fall behind master: 0 bytes
2020-04-03 05:14:36 INFO brokerOutApi_thread_4 - register broker[0]to name server xxxxxx:9876 OK
2020-04-03 05:14:42 INFO BrokerControllerScheduledThread1 - dispatch behind commit log 0 bytes
2020-04-03 05:14:42 INFO brokerOutApi_thread_2 - register broker[1]to name server xxxxxx:9876 OK
it's the producer client log and broker log at that time, then has no response includes success or failed,
i can not find this message on the broker also.
the client sends about more 100 msgs and just losts these two.
this JVM includes more than one producer which has the same instanceName, it has a problem?
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services