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 message while using rdkafka_example_cpp #53

Closed
akuzayah opened this issue Nov 17, 2015 · 9 comments
Closed

Error message while using rdkafka_example_cpp #53

akuzayah opened this issue Nov 17, 2015 · 9 comments

Comments

@akuzayah
Copy link

Hi, i new in kafka, after I installed librdkafka, then run an example file, i have the some issues when using its. When using rdkafka_example_cpp to set up producer:

rdkafka_example_cpp -P -t my_topic -p 1 -b 127.0.0.1:9092

i got these outputs:

% Created producer rdkafka#producer-0
LOG-3-FAIL: 127.0.0.1:9091/bootstrap: Failed to connect to broker at new-host:9091: Connection refused

and when using rdkafka_example_cpp to set up consumer:

rdkafka_example_cpp -C -t my_topic -p 3 -b 127.0.0.1:9093

a got this these outputs :

% Created consumer rdkafka#consumer-0
LOG-3-FAIL: 127.0.0.1:9093/bootstrap: Failed to connect to broker at new-host:9093: Connection refused
ERROR (Local: Broker transport failure): 127.0.0.1:9093/bootstrap: Failed to connect to broker at new-host:9093: Connection refused
ERROR (Local: All broker connections are down): 1/1 brokers are down

after I was looking at the same problem here, I get an explanation that the problem is caused by the use of ipv4 or ipv6. I've checked the IP version used, and I think my problem does not lie there.is there any suggestion, what's wrong with above command? Thx.

@edenhill
Copy link
Owner

Connection refused means librdkafka can't TCP connect to a given broker.
One of your brokers advertises itself as new-host:9093, but there is no broker running on that host+port, or it is firewalled.

Check your connectivity (you can use telnet new-host 9093 from the host kafkacat runs on to see if you have connectivity.

@akuzayah
Copy link
Author

I've opened port 9092: 9100 on the firewall

I think the broker will automatically run when I run rdkafka_example_cpp, because the address localhost: 9092 is the default address for the broker. Or maybe I missed some steps. if there are steps that must be done before running rdkafka_example_cpp, to run the broker for example?

@edenhill
Copy link
Owner

Please dont duplicate each comment to two issues, lets keep discussion here.

You will need to start your Kafka cluster first before starting your clients.
See here for more info on how to start zookeeper and kafka:
http://kafka.apache.org/documentation.html#quickstart

When that is started you should be able to connect a client to it.

@akuzayah
Copy link
Author

oh, sorry, that was my mistake. I'm really beginner in using github. I did not see the title of the topic when I replied.

Actually I've made a cluster as in kafka #quickstart.

  1. Start zookeper server: bin / zookeeper-server-start.sh config / zookeeper.properties
  2. Start kafka server: bin / kafka-server-start.sh config / server.properties (broker.id=0, port=9092)
  3. create a topic: bin / kafka-topics.sh --create --zookeeper localhost: 2181 --replication-factor 1 --partitions 1 --topic test

then, I can make producers and consumers and also send a message through original kafka-console-producer.sh & kafka-console-consumer.sh as on kafka #quickstart, but when using rdkafka_example_cpp :

examples/rdkafka_example_cpp -P -t test -p 1 -b localhost:9092

I get the following error:

% Created producer-producer rdkafka # 0
rdkafka_example_cpp: ../sysdeps/posix/getaddrinfo.c:1465: rfc3484_sort: assertion `src-> results [i] == -1 || .native src-> results [i] == .native a2_native 'failed.
Aborted

did i miss something ?

@edenhill
Copy link
Owner

Never seen that error before, thats inside the libc resolver. Weird.

What operating system are you using?

Can you run the program in gdb and provide a backtrace printout when it crashes?

@akuzayah
Copy link
Author

i am using openSUSE 11.3.

Here is an output when run using gdb mode:

(gdb) run -P -t test -p 1 -b localhost:9092
[Thread debugging using libthread_db enabled]
[New Thread 0xb7ce3b70 (LWP 10045)]
[New Thread 0xb74e2b70 (LWP 10046)]
% Created producer rdkafka#producer-0
[New Thread 0xb6ce1b70 (LWP 10047)]
rdkafka_example_cpp: ../sysdeps/posix/getaddrinfo.c:1465: rfc3484_sort: Assertion `src->results[i].native == -1 || src->results[i].native == a2_native' failed.

Program received signal SIGABRT, Aborted.
[Switching to Thread 0xb6ce1b70 (LWP 10047)]
0xffffe424 in __kernel_vsyscall ()
(gdb)

@edenhill
Copy link
Owner

Can you provide the output backtrace from the crash in gdb, please?

@akuzayah
Copy link
Author

here is the full backtrace :

(gdb) thread apply all backtrace full

Thread 4 (Thread 0xb6ce1b70 (LWP 14225)):
#0  0xffffe424 in __kernel_vsyscall ()
No symbol table info available.
#1  0xb7d127af in raise () from /lib/libc.so.6
No symbol table info available.
#2  0xb7d140f0 in abort () from /lib/libc.so.6
No symbol table info available.
#3  0xb7d0b014 in __assert_fail () from /lib/libc.so.6
No symbol table info available.
#4  0xb7da109b in rfc3484_sort () from /lib/libc.so.6
No symbol table info available.
#5  0xb7d147f8 in msort_with_tmp () from /lib/libc.so.6
No symbol table info available.
#6  0xb7d14d11 in qsort_r () from /lib/libc.so.6
No symbol table info available.
#7  0xb7da26c9 in getaddrinfo () from /lib/libc.so.6
No symbol table info available.
#8  0x08071577 in rd_getaddrinfo (nodesvc=0x80819e4 "linux-gyrw.site:9092", defsvc=<value optimized out>, flags=32, family=0, socktype=1, protocol=6, errstr=0xb6ce0a1c)
    at rdaddr.c:161
        hints = {ai_flags = 32, ai_family = 0, ai_socktype = 1, ai_protocol = 6, ai_addrlen = 0, ai_addr = 0x0, ai_canonname = 0x0, ai_next = 0x0}
        ais = <value optimized out>
        ai = <value optimized out>
        node = 0xb6ce12ac "linux-gyrw.site"
        svc = 0xb6ce126c "9092"
        r = <value optimized out>
        cnt = 0
        rsal = <value optimized out>
#9  0x080641dc in rd_kafka_broker_resolve (arg=0x8081588) at rdkafka_broker.c:580
        errstr = 0x0
#10 rd_kafka_broker_connect (arg=0x8081588) at rdkafka_broker.c:1584
        sinx = 0x8080390
        one = 1
        on = 1
#11 rd_kafka_broker_thread_main (arg=0x8081588) at rdkafka_broker.c:4216
        rkb = 0x8081588
        rk = 0x8080390
#12 0xb7fadb25 in start_thread () from /lib/libpthread.so.0
No symbol table info available.
#13 0xb7dba38e in clone () from /lib/libc.so.6
No symbol table info available.

---Type <return> to continue, or q <return> to quit---
Thread 3 (Thread 0xb74e2b70 (LWP 14224)):
#0  0xffffe424 in __kernel_vsyscall ()
No symbol table info available.
#1  0xb7daf67e in poll () from /lib/libc.so.6
No symbol table info available.
#2  0x08062ec0 in rd_kafka_broker_io_serve (rkb=0x8080608) at rdkafka_broker.c:2522
        rko = <value optimized out>
#3  0x08064e10 in rd_kafka_broker_ua_idle (arg=0x8080608) at rdkafka_broker.c:2550
        last_timeout_scan = 198726233757
#4  rd_kafka_broker_thread_main (arg=0x8080608) at rdkafka_broker.c:4232
        rkb = 0x8080608
        rk = 0x8080390
#5  0xb7fadb25 in start_thread () from /lib/libpthread.so.0
No symbol table info available.
#6  0xb7dba38e in clone () from /lib/libc.so.6
No symbol table info available.

Thread 2 (Thread 0xb7ce3b70 (LWP 14223)):
#0  0xffffe424 in __kernel_vsyscall ()
No symbol table info available.
#1  0xb7fb2452 in pthread_cond_timedwait@@GLIBC_2.3.2 () from /lib/libpthread.so.0
No symbol table info available.
#2  0x080539bf in pthread_cond_timedwait_ms (cond=0x80805cc, mutex=0x80805b4, timeout_ms=999) at rdkafka.c:109
        tv = {tv_sec = 1447843853, tv_usec = 83955}
        ts = {tv_sec = 1447843854, tv_nsec = 82955000}
#3  0x0806ede4 in rd_kafka_timers_run (rk=0x8080390, timeout=1000000) at rdkafka_timer.c:154
        sleeptime = 999993
        rtmr = <value optimized out>
        now = <value optimized out>
        end = 198727232804
#4  0x080584f8 in rd_kafka_thread_main (arg=0x8080390) at rdkafka.c:1204
        rk = 0x8080390
        tmr_topic_scan = {rtmr_link = {tqe_next = 0xb7ce29cc, tqe_prev = 0x80805ac}, rtmr_next = 198727232797, rtmr_interval = 1000000, 
          rtmr_callback = 0x8051db0 <rd_kafka_topic_scan_tmr_cb>, rtmr_arg = 0x0}
        tmr_stats_emit = {rtmr_link = {tqe_next = 0x0, tqe_prev = 0x0}, rtmr_next = 0, rtmr_interval = 0, rtmr_callback = 0x8054770 <rd_kafka_stats_emit_tmr_cb>, 
          rtmr_arg = 0x0}
        tmr_metadata_refresh = {rtmr_link = {tqe_next = 0x0, tqe_prev = 0xb7ce2a04}, rtmr_next = 199326232803, rtmr_interval = 600000000, 
          rtmr_callback = 0x80518e0 <rd_kafka_metadata_refresh_cb>, rtmr_arg = 0x0}
#5  0xb7fadb25 in start_thread () from /lib/libpthread.so.0
No symbol table info available.
#6  0xb7dba38e in clone () from /lib/libc.so.6
No symbol table info available.
---Type <return> to continue, or q <return> to quit---

Thread 1 (Thread 0xb7ce5020 (LWP 14222)):
#0  0xffffe424 in __kernel_vsyscall ()
No symbol table info available.
#1  0xb7da989b in read () from /lib/libc.so.6
No symbol table info available.
#2  0xb7d51b23 in _IO_new_file_underflow () from /lib/libc.so.6
No symbol table info available.
#3  0xb7d52d29 in _IO_default_uflow_internal () from /lib/libc.so.6
No symbol table info available.
#4  0xb7d52b26 in __uflow () from /lib/libc.so.6
No symbol table info available.
#5  0xb7d4d41b in getc () from /lib/libc.so.6
No symbol table info available.
#6  0xb7f1f145 in __gnu_cxx::stdio_sync_filebuf<char, std::char_traits<char> >::underflow() () from /usr/lib/libstdc++.so.6
No symbol table info available.
#7  0xb7f0b796 in std::basic_istream<char, std::char_traits<char> >& std::getline<char, std::char_traits<char>, std::allocator<char> >(std::basic_istream<char, std::char_traits<char> >&, std::basic_string<char, std::char_traits<char>, std::allocator<char> >&, char) () from /usr/lib/libstdc++.so.6
No symbol table info available.
#8  0x0804ce89 in getline<char, std::char_traits<char>, std::allocator<char> > (argc=0, argv=0x0) at /usr/include/c++/4.5/bits/basic_string.h:2643
No locals.
#9  main (argc=0, argv=0x0) at rdkafka_example.cpp:411
        line = ""
        ex_dr_cb = {<RdKafka::DeliveryReportCb> = {_vptr.DeliveryReportCb = 0x807cc00}, <No data fields>}
        producer = 0x8080260
        topic = 0x8080b88
        brokers = "localhost:9092"
        errstr = ""
        mode = "P"
        debug = ""
        tconf = 0x8080180
        topic_str = "test"
        partition = 1
        start_offset = -2
        do_conf_dump = false
        opt = <value optimized out>
        hash_partitioner = {<RdKafka::PartitionerCb> = {_vptr.PartitionerCb = 0x807cba0}, <No data fields>}
        conf = 0xb7f82f40
        use_ccb = 0
        ex_event_cb = {<RdKafka::EventCb> = {_vptr.EventCb = 0x807cbd0}, <No data fields>}
(gdb) 

@edenhill
Copy link
Owner

This seems to be a glibc bug:
https://sourceware.org/ml/libc-alpha/2013-08/msg00582.html

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

2 participants