Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

consumer Exception zlib error #453

Open
huangwjwork opened this issue Aug 26, 2023 · 3 comments
Open

consumer Exception zlib error #453

huangwjwork opened this issue Aug 26, 2023 · 3 comments

Comments

@huangwjwork
Copy link

I use python client (https://github.com/apache/rocketmq-client-python) to call rocketmq-client-cpp ,and when I consumer some messages,I get that:

terminate called ater throwing an instance of 'boost::exception_detail::clone_impl<boost::exception_detail::error_info_injectorboost:iostreams::zlib_error>'
what(): zlib error

my env:

os rhel7.9
kernle:3.10.0-1160
clinet: rocketmq-client-cpp-2.1.0 rocketmq-client-cpp-2.0.0 (Both versions have this issue)

@zadley
Copy link

zadley commented Oct 19, 2023

我们也碰到这个问题了,请问下这个问题修复了没?

@Yanhuanjin
Copy link

I also met this problem, and even after updated my zlib version, this problem still remains.

@gfzhai
Copy link

gfzhai commented Nov 12, 2023

我在测试C++接口时也遇到了同样的问题,在接口中增加日志排查后发现是调用接口的用法存在问题:
C++的send接口时传递的MQMessage对象的引用,如果上一次的MQMessage的大小超过设置的压缩限制,就会启动压缩,那么在send接口返回后,MQMessage对象也会被修改(设置压缩标记、Body也被替换成压缩后的内容)。
如果下一次调用send接口时,复用上一次的MQMessage对象,只修改Body,就会出现Body内容和压缩标记不一致的现象,导致消息(内容没压缩但标记着已经压缩)传递给消费者后出现无法解压的错误。

错误代码示例:

  rocketmq::MQMessage msg(topic, tag, "");
  for (unsigned i = 0; i < send_num; ++i) {
    try {
      char *body = new char[send_size];

      msg.setBody(body, send_size);  // msg被重新设置内容,但是标记不变

      rocketmq::SendResult sendResult = producer->send(msg);
printf("msg size[%d]\n", msg.getBody().length());
      delete []body;
    } catch (rocketmq::MQException &e) {
      printf("send error[%d][%s]", e.GetError(), e.what());
      return -1;
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants