Vibhuti
Vibhuti

Reputation: 1634

kafka: Can't bind: topic error

I am getting below error, when i am increasing number of kafka producer. Any one has idea what can be the problem here?

Please find my producer settings: https://gist.github.com/Vibhuti/dbf1c24962b91f2bc217

Error logs:

main::catch {...} ("<UNKNOWN> Can't bind: topic = 'testing_producer' at /opt/adp/"...) called at /opt/adp/projects/code_coverage/perl//5.10/lib/site_perl/5.10.1/Try/Tiny.pm line 104
Try::Tiny::try(CODE(0xabdf8d0), Try::Tiny::Catch=REF(0xabdb938)) called at ./stream_binary_hadoop.pl line 184
main::stream(HASH(0xac5fde0)) called at ./stream_binary_hadoop.pl line 347
main::file_split(HASH(0xabe71e0)) called at ./stream_binary_hadoop.pl line 406

<UNKNOWN> <UNKNOWN> Can't bind: topic = 'testing_producer' at /opt/adp/projects/code_coverage/perl//5.10/lib/site_perl/5.10.1/Exception/Class/Base.pm line 85.
Exception::Class::Base::throw("Kafka::Exception::Connection", "code", -1004, "message", "Can't bind: topic = 'testing_producer'") called at /opt/adp/projects/code_coverage/perl//5.10/lib/site_perl/5.10.1/Kafka/Connection.pm line 1303
Kafka::Connection::_error(Kafka::Connection=HASH(0x176f9f40), -1004, "topic = 'testing_producer'") called at /opt/adp/projects/code_coverage/perl//5.10/lib/site_perl/5.10.1/Kafka/Connection.pm line 814
Kafka::Connection::receive_response_to_request(Kafka::Connection=HASH(0x176f9f40), HASH(0x17767738), undef) called at /opt/adp/projects/code_coverage/perl//5.10/lib/site_perl/5.10.1/Kafka/Producer.pm line 363
Kafka::Producer::send(Kafka::Producer=HASH(0x176fa1f8), "testing_producer", 0, "56b4b2b23c24c3608376d1f0,/obj/i386/junos/lib/librtsock/iff_ms"...) called at ./stream_binary_hadoop.pl line 171
main::try {...} () called at /opt/adp/projects/code_coverage/perl//5.10/lib/site_perl/5.10.1/Try/Tiny.pm line 81
eval {...} called at /opt/adp/projects/code_coverage/perl//5.10/lib/site_perl/5.10.1/Try/Tiny.pm line 72
Try::Tiny::try(CODE(0x1776fa40), Try::Tiny::Catch=REF(0x1776a6b0)) called at ./stream_binary_hadoop.pl line 184
main::stream(HASH(0x1775f6c0)) called at ./stream_binary_hadoop.pl line 347
main::file_split(HASH(0x1775e790)) called at ./stream_binary_hadoop.pl line 406

For reference, my kafka code:

my $arcs_val = join( ',', @arc_a );
my $hadoop_str = $testid . ',' . $gcda_file_name . ',' . $arcs_val;
utf8::downgrade($hadoop_str);
try {
        #my $topic = utf8::downgrade($testid);;
        my $topic = utf8::downgrade($testid);
        my $partition = 0;
        my $response = $producer->send(
              "testing_producer",             # topic
              $partition,                  # partition
              $hadoop_str
        );
} catch {
        my $error = $_;
        if ( blessed( $error ) && $error->isa( 'Kafka::Exception' ) ) {             warn 'Error: (', $error->code, ') ',  $error->message, "\n";
              exit;
        } else {
              die $error;
        }
};

Upvotes: 1

Views: 446

Answers (1)

Marty
Marty

Reputation: 2808

It's simply failing to connect at the TCP level - network problem, perhaps?

From the early lines of your trace dump, its clear that Kafka uses Exception::Class for error handling. The specific Exception being thrown is Kafka::Exception::Connection and the message is "Can't bind: topic = 'testing_producer'" which, according to the doco is caused by:

A successful TCP connection cant be established on given host and port.

As its TCP, you can do a quick and easy test if the client has a "Telnet client". Simply enter the hostname/IP and port number of the server into the Telnet client and click "connect". If it connects, simply drop the connection - you will have confirmed that its not the network. If it fails, you will have confirmed that it is a network issue.

Upvotes: 1

Related Questions