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

*** Error in `/opt/app': double free or corruption (fasttop): 0x000000000570b960 *** #746

Open
FabioNevesRezende opened this issue Jan 18, 2023 · 0 comments

Comments

@FabioNevesRezende
Copy link

*** Error in `/opt/app': double free or corruption (fasttop): 0x000000000570b960 ***
======= Backtrace: =========
/lib64/libc.so.6(+0x81329)[0x7fbd4a0b9329]
/opt/app(_ZN8RabbitMQ14consumerRabbitER11ApplicationRKSs+0x3d5)[0x8b332b]
/opt/app(main+0xe06)[0x837dc1]
/lib64/libc.so.6(__libc_start_main+0xf5)[0x7fbd4a05a555]
/opt/app[0x836e61]
======= Memory map: ========
00400000-00d22000 r-xp 00000000 103:02 8537181 /opt/app
00f21000-00f2b000 r--p 00921000 103:02 8537181 /opt/app
00f2b000-00f2e000 rw-p 0092b000 103:02 8537181 /opt/app
00f2e000-00f33000 rw-p 00000000 00:00 0
02b51000-05851000 rw-p 00000000 00:00 0

The consumer rabbit function is:

bool RabbitMQ::consumerRabbit(Application & application)
{
  try {
    amqp_rpc_reply_t res;
    amqp_envelope_t envelope;

    envelope.delivery_tag = true;

    amqp_maybe_release_buffers(_mConn);

    res = amqp_consume_message(_mConn, &envelope, NULL, 0);
    readmessages++;

    std::string str;
    str.clear();
    if (AMQP_RESPONSE_LIBRARY_EXCEPTION == res.reply_type &&
      AMQP_STATUS_UNEXPECTED_STATE == res.library_error)
    {
      std::string error_msg("RabbitMQ::consumerRabbit Error: Erro ao retirar elemento da fila");
      std::string libError(amqp_error_string2(res.library_error));

      if (res.library_error)
        error_msg += ": " + libError;
	  std::cout << error_msg << std::endl;

      return false;
    }


    if (envelope.message.body.len > 0)
    {
      getEnvelopeStrAndLog(envelope, str);

      amqp_basic_ack(_mConn, 1, envelope.delivery_tag, true);

      while ((!application.isConnected())) {
        boost::this_thread::sleep(boost::posix_time::milliseconds(500));
        amqp_basic_nack(_mConn, 1, envelope.delivery_tag, true, true);
      }

      amqp_destroy_envelope(&envelope);
      // do stuff with message str 
    }
    return true;
  }
  catch (std::exception& e) {
    return false;
  }
}

The connection part is similar to the example here
any guess what could be wrong when reading from the socket?

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

1 participant