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

use the produce of the librdkafka c++ interface ,the program report "Program terminated with signal 6, Aborted" #2571

Closed
hyhtemple opened this issue Oct 14, 2019 · 8 comments

Comments

@hyhtemple
Copy link

I want to use "RdKafka::Producer" of the librdkafka's interface to send message to kafka
but Recently the program was crashed , i don't known what happend , i print the program backstrace looks like this
Program terminated with signal 6, Aborted.
#0 0x00007faf95c4d5d7 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
56 return INLINE_SYSCALL (tgkill, 3, pid, selftid, sig);
(gdb) bt
#0 0x00007faf95c4d5d7 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
#1 0x00007faf95c4ecc8 in __GI_abort () at abort.c:90
#2 0x00007faf992a68cd in rd_kafka_crash (file=, line=, function=, rk=0x2500eb0, reason=) at rdkafka.c:3115
#3 0x00007faf992ecb1c in rd_kafka_toppar_destroy_final (rktp=0x7faec4005900) at rdkafka_partition.c:269
#4 0x00007faf992d7212 in rd_kafka_handle_Produce (rk=, rkb=0x2502220, err=RD_KAFKA_RESP_ERR_UNKNOWN_TOPIC_OR_PART, reply=, request=0x7fac8
at rdkafka_request.c:1934
#5 0x00007faf992cc06d in rd_kafka_buf_callback (rk=0xb8ec, rkb=0xb93c, err=RD_KAFKA_RESP_ERR_NO_ERROR, response=0x7faecc001880, request=0x7fac80bf5f80) at rdkafka_buf.c
#6 0x00007faf992b5681 in rd_kafka_req_response (rkbuf=, rkb=) at rdkafka_broker.c:1063
#7 rd_kafka_recv (rkb=0x2502220) at rdkafka_broker.c:1175
#8 0x00007faf992ca601 in rd_kafka_transport_io_event (rktrans=0x7faecc0008c0, events=5) at rdkafka_transport.c:1355
#9 0x00007faf992bc7fb in rd_kafka_broker_serve (rkb=0x2502220, abs_timeout=32849616505992) at rdkafka_broker.c:2293
#10 0x00007faf992be22f in rd_kafka_broker_producer_serve (rkb=) at rdkafka_broker.c:2580
#11 rd_kafka_broker_thread_main (arg=) at rdkafka_broker.c:3309
#12 0x00007faf992f5e40 in _thrd_wrapper_function (aArg=) at tinycthread.c:624
#13 0x00007faf98e99df5 in start_thread (arg=0x7faedb7fe700) at pthread_create.c:308
#14 0x00007faf95d0e1ad in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:113

I am using the version of librdkafka is 0.11.4
linux system CentOS 7.x

Has anyone encountered the same problem?

@hyhtemple
Copy link
Author

The following is the code fragment I called:
RdKafka::ErrorCode resp = mProducer->produce((RdKafka::Topic*)Fd_Itr->second,
RdKafka::Topic::PARTITION_UA,
RdKafka::Producer::RK_MSG_COPY,
const_cast<char *>(msg), len,
index.c_str(), index.size(), NULL);
if (resp != RdKafka::ERR_NO_ERROR)
{
err = RdKafka::err2str(resp);
GLOGEX_E(("Produce failed! topic=%s, resp=%u, err=%s, len=%u, msg=%s.", Fd_Itr->first.c_str(), resp, err.c_str(), len, msg));
return CPSS_KAFKA_ERROR;
}
int CpssKafkaTimeToWait = 0;//TODO -1:wait indefinately, 0:non-block
int ev_num = mProducer->poll(CpssKafkaTimeToWait);

@edenhill
Copy link
Contributor

  1. upgrade to the latest version of librdkafka, v.1.2.x. (https://github.com/edenhill/librdkafka#community-support)
  2. make sure your Topic object is valid throughout the runtime of the producer, or preferably, dont instantiate a Topic object but instead use the topic_name version of produce()

@hyhtemple
Copy link
Author

thank you for you anwser my question, Is there a problem sending in this way?

@edenhill
Copy link
Contributor

@sherimao
Copy link

  1. upgrade to the latest version of librdkafka, v.1.2.x. (https://github.com/edenhill/librdkafka#community-support)
  2. make sure your Topic object is valid throughout the runtime of the producer, or preferably, dont instantiate a Topic object but instead use the topic_name version of produce()

Could you tell me how you solve this problem in 1.2.x? Why does it happen in the previous version?
This problem happens sometimes(not always) when kafka topic doesn't exist.

@edenhill
Copy link
Contributor

@sherimao librdkafka v1.5.0 is the latest version.
And you will have to provide more information, a full backtrace from the crash for instance.

@sherimao
Copy link

@sherimao librdkafka v1.5.0 is the latest version.
And you will have to provide more information, a full backtrace from the crash for instance.

@edenhill I don't mean v1.5 has this problem. I use v1.2.0 and this problem is solved. I just want to know why it happens in the previous version and how you solve it. Thanks

@edenhill
Copy link
Contributor

Without a backtrace it is impossible to identify the crash in previous versions.
If you're not able to provide a backtrace I recommend checking the release notes for changes: https://github.com/edenhill/librdkafka/releases/

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

3 participants