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

No provider for SASL mechanism GSSAPI error #567

Open
4 of 7 tasks
ikyriakidis opened this issue Jul 11, 2018 · 15 comments
Open
4 of 7 tasks

No provider for SASL mechanism GSSAPI error #567

ikyriakidis opened this issue Jul 11, 2018 · 15 comments
Labels
bug investigate further we want to further investigate to understand properly

Comments

@ikyriakidis
Copy link

ikyriakidis commented Jul 11, 2018

Description

The issue is similar to issue 550.

An exception of type 'System.InvalidOperationException' occurred in Confluent.Kafka.dll but was not handled in user code: 'No provider for SASL mechanism GSSAPI: recompile librdkafka with libsasl2 or openssl support. Current build options: PLAIN SASL_SCRAM'

How to reproduce

  1. Create .net core application targeting netcoreapp 2.1
  2. Add Confluent.Kafka 0.11.4 nugget package
  3. Add docker suport
  4. Use the sample Consumer from confluent-kafka-dotnet
  5. Use the following config
            var config = new Dictionary<string, object>
            {
                { "bootstrap.servers", "bootsrap-server9092" },
                { "group.id", "SIMC" },
                { "enable.auto.commit", true },  // this is the default
                { "auto.commit.interval.ms", 5000 },
                { "statistics.interval.ms", 60000 },
                { "session.timeout.ms", 6000 },
                { "auto.offset.reset", "smallest" },
                { "acks" , "1" },
                { "client.id" , "SIMC" },
                { "batch.num.messages", 1 },
                { "debug","all" },
                { "security.protocol","SASL_SSL" },
                { "sasl.mechanisms", "GSSAPI" },
                { "sasl.kerberos.service.name", "kafka" },
                { "sasl.kerberos.principal","cons"},
                { "sasl.kerberos.keytab","/etc/keytab/cons.keytab" },
                { "sasl.kerberos.kinit.cmd","'kinit cons -k -t /etc/keytab/cons.keytab'" },
                { "ssl.ca.location","/certificates/ca-cert-kafka" },
                { "ssl.certificate.location","/certificates/client.net.local_client.pem" },
                { "ssl.key.location","/certificates/client.net.local_client.key" },
                { "ssl.key.password","password" }
            };

Dockerfile

# Get sdk image
FROM microsoft/dotnet:2.1-sdk as builder

# Download dependency for building  librdkafka
RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF \
	&& echo "deb http://download.mono-project.com/repo/debian stretch main" | tee /etc/apt/sources.list.d/mono-official.list \
	&& apt-get update && apt-get install -y mono-devel default-jre build-essential libssl-dev libsasl2-2 libsasl2-dev libsasl2-modules-gssapi-mit wget unzip

# Build librdkafka
COPY ./lib/ /
RUN ls -l && cd / && unzip librdkafka-v0.11.4.zip && \
	cd librdkafka-0.11.4 && \
	./configure && \
	make && \
	make install

# Copy all files from current directory (.) to app folder in container.
RUN mkdir -p /app
COPY . /app

RUN cd /app && dotnet restore --configfile /app/src/Qliro.Simple.Consumer/NuGet.config && \
dotnet build && \
dotnet publish -c Release -o /app/bin/Qliro.Simple.Consumer ./src/Qliro.Simple.Consumer

# Get Runtime image
FROM microsoft/dotnet:2.1-runtime

# Create a user group and add the user
RUN groupadd -r grp-cons && \
	useradd -r -g grp-cons -s /sbin/nologin svc-cons-consumer

# Install runtime dependencies - kerberos clients etc
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -y install krb5-user kstart \
	 build-essential libssl-dev libsasl2-2 libsasl2-dev libsasl2-modules-gssapi-mit libsasl2-modules && \
	 mkdir -p /opt/cons

# Copy files from build container to rutime container
COPY --from=builder /app/bin/ /opt/cons/bin/
COPY --from=builder /app/docker/startup.sh /opt/cons/
COPY --from=builder /usr/local/lib/librdkafka* /opt/cons/bin/

# Give execute permissions to file
RUN chmod +x /opt/cons/startup.sh && ls -lR /opt/cons

RUN chgrp grp-cons /opt/cons/

ENTRYPOINT ["/opt/cons/startup.sh"]

Checklist

Please provide the following information:

  • Confluent.Kafka nuget version: 0.11.4
  • Apache Kafka version: 1.0.0
  • Client configuration:
  • Operating system: Debian GNU/Linux 9 (stretch)
  • Provide logs (with "debug" : "..." as necessary in configuration)
  • Provide broker log excerpts
  • Critical issue
@mhowlett
Copy link
Contributor

@rnpridgeon - do you have any insight on this one?

@rnpridgeon
Copy link

Looks like it should be compiling correctly at a glance. Do we by chance capture the output generated when we execute ./configure and make? Might be a good idea to do a quick sanity check by reviewing the contents of this output. As long as we see libsasl2 in there I would expect that librdkafka would be compiled with support for GSSAPI.

@ikyriakidis
Copy link
Author

checking for OS or distribution... ok (Linux)
checking for C compiler from CC env... failed
checking for gcc (by command)... ok
checking for C++ compiler from CXX env... failed
checking for C++ compiler (g++)... ok
checking executable ld... ok
checking executable nm... ok
checking executable objdump... ok
checking executable strip... ok
checking for pkgconfig (by command)... ok
checking for install (by command)... ok
checking for PIC (by compile)... ok
checking for GNU-compatible linker options... ok
checking for GNU linker-script ld flag... ok
checking for __atomic_32 (by compile)... ok
checking for __atomic_64 (by compile)... ok
checking for socket (by compile)... ok
parsing version '0x000b04ff'... ok (0.11.4)
checking for librt (by pkg-config)... failed
checking for librt (by compile)... ok
checking for libpthread (by pkg-config)... failed
checking for libpthread (by compile)... ok
checking for libdl (by pkg-config)... failed
checking for libdl (by compile)... ok
checking for zlib (by pkg-config)... failed
checking for zlib (by compile)... failed (disable)
checking for libcrypto (by pkg-config)... ok
checking for libcrypto (by compile)... ok (cached)
checking for liblz4 (by pkg-config)... failed
checking for liblz4 (by compile)... failed (disable)
checking for libssl (by pkg-config)... ok
checking for libssl (by compile)... ok (cached)
checking for libsasl2 (by pkg-config)... ok
checking for libsasl2 (by compile)... ok (cached)
checking for crc32chw (by compile)... ok
checking for regex (by compile)... ok
checking for strndup (by compile)... ok
checking for strerror_r (by compile)... ok
checking for pthread_setname_gnu (by compile)... ok
checking for nm (by env NM)... ok (cached)
checking for python (by command)... ok
Generated Makefile.config
Generated config.h

Configuration summary:
  prefix                   /usr/local
  ARCH                     x86_64
  CPU                      generic
  GEN_PKG_CONFIG           y
  ENABLE_DEVEL             n
  ENABLE_VALGRIND          n
  ENABLE_REFCNT_DEBUG      n
  ENABLE_SHAREDPTR_DEBUG   n
  ENABLE_LZ4_EXT           y
  ENABLE_SSL               y
  ENABLE_SASL              y
  MKL_APP_NAME             librdkafka
  MKL_APP_DESC_ONELINE     The Apache Kafka C/C++ library
  MKL_DISTRO               Linux
  SOLIB_EXT                .so
  CC                       gcc
  CXX                      g++
  LD                       ld
  NM                       nm
  OBJDUMP                  objdump
  STRIP                    strip
  CPPFLAGS                 -g -O2 -fPIC -Wall -Wsign-compare -Wfloat-equal -Wpointer-arith -Wcast-align
  PKG_CONFIG               pkg-config
  INSTALL                  install
  LIB_LDFLAGS              -shared -Wl,-soname,$(LIBFILENAME)
  LDFLAG_LINKERSCRIPT      -Wl,--version-script=
  RDKAFKA_VERSION_STR      0.11.4
  MKL_APP_VERSION          0.11.4
  LIBS                     -lsasl2 -lssl -lcrypto -ldl -lpthread -lrt
  CFLAGS                   
  CXXFLAGS                 -Wno-non-virtual-dtor
  SYMDUMPER                $(NM) -D
  exec_prefix              /usr/local
  bindir                   /usr/local/bin
  sbindir                  /usr/local/sbin
  libexecdir               /usr/local/libexec
  datadir                  /usr/local/share
  sysconfdir               /usr/local/etc
  sharedstatedir           /usr/local/com
  localstatedir            /usr/local/var
  libdir                   /usr/local/lib
  includedir               /usr/local/include
  infodir                  /usr/local/info
  mandir                   /usr/local/man
Generated config.cache

Now type 'make' to build
make[1]: Entering directory '/librdkafka-0.11.4/src'
gcc -MD -MP -g -O2 -fPIC -Wall -Wsign-compare -Wfloat-equal -Wpointer-arith -Wcast-align  -c rdkafka.c -o rdkafka.o
gcc -MD -MP -g -O2 -fPIC -Wall -Wsign-compare -Wfloat-equal -Wpointer-arith -Wcast-align  -c rdkafka_broker.c -o rdkafka_broker.o
gcc -MD -MP -g -O2 -fPIC -Wall -Wsign-compare -Wfloat-equal -Wpointer-arith -Wcast-align  -c rdkafka_msg.c -o rdkafka_msg.o
gcc -MD -MP -g -O2 -fPIC -Wall -Wsign-compare -Wfloat-equal -Wpointer-arith -Wcast-align  -c rdkafka_topic.c -o rdkafka_topic.o
gcc -MD -MP -g -O2 -fPIC -Wall -Wsign-compare -Wfloat-equal -Wpointer-arith -Wcast-align  -c rdkafka_conf.c -o rdkafka_conf.o
gcc -MD -MP -g -O2 -fPIC -Wall -Wsign-compare -Wfloat-equal -Wpointer-arith -Wcast-align  -c rdkafka_timer.c -o rdkafka_timer.o
gcc -MD -MP -g -O2 -fPIC -Wall -Wsign-compare -Wfloat-equal -Wpointer-arith -Wcast-align  -c rdkafka_offset.c -o rdkafka_offset.o
gcc -MD -MP -g -O2 -fPIC -Wall -Wsign-compare -Wfloat-equal -Wpointer-arith -Wcast-align  -c rdkafka_transport.c -o rdkafka_transport.o
�[91mrdkafka_transport.c:437:22: warning: 'rd_kafka_transport_ssl_threadid_cb' defined but not used [-Wunused-function]
 static unsigned long rd_kafka_transport_ssl_threadid_cb (void) {
                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
rdkafka_transport.c:429:13: warning: 'rd_kafka_transport_ssl_lock_cb' defined but not used [-Wunused-function]
 static void rd_kafka_transport_ssl_lock_cb (int mode, int i,
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
�[0mgcc -MD -MP -g -O2 -fPIC -Wall -Wsign-compare -Wfloat-equal -Wpointer-arith -Wcast-align  -c rdkafka_buf.c -o rdkafka_buf.o
gcc -MD -MP -g -O2 -fPIC -Wall -Wsign-compare -Wfloat-equal -Wpointer-arith -Wcast-align  -c rdkafka_queue.c -o rdkafka_queue.o
gcc -MD -MP -g -O2 -fPIC -Wall -Wsign-compare -Wfloat-equal -Wpointer-arith -Wcast-align  -c rdkafka_op.c -o rdkafka_op.o
gcc -MD -MP -g -O2 -fPIC -Wall -Wsign-compare -Wfloat-equal -Wpointer-arith -Wcast-align  -c rdkafka_request.c -o rdkafka_request.o
gcc -MD -MP -g -O2 -fPIC -Wall -Wsign-compare -Wfloat-equal -Wpointer-arith -Wcast-align  -c rdkafka_cgrp.c -o rdkafka_cgrp.o
gcc -MD -MP -g -O2 -fPIC -Wall -Wsign-compare -Wfloat-equal -Wpointer-arith -Wcast-align  -c rdkafka_pattern.c -o rdkafka_pattern.o
gcc -MD -MP -g -O2 -fPIC -Wall -Wsign-compare -Wfloat-equal -Wpointer-arith -Wcast-align  -c rdkafka_partition.c -o rdkafka_partition.o
gcc -MD -MP -g -O2 -fPIC -Wall -Wsign-compare -Wfloat-equal -Wpointer-arith -Wcast-align  -c rdkafka_subscription.c -o rdkafka_subscription.o
gcc -MD -MP -g -O2 -fPIC -Wall -Wsign-compare -Wfloat-equal -Wpointer-arith -Wcast-align  -c rdkafka_assignor.c -o rdkafka_assignor.o
gcc -MD -MP -g -O2 -fPIC -Wall -Wsign-compare -Wfloat-equal -Wpointer-arith -Wcast-align  -c rdkafka_range_assignor.c -o rdkafka_range_assignor.o
gcc -MD -MP -g -O2 -fPIC -Wall -Wsign-compare -Wfloat-equal -Wpointer-arith -Wcast-align  -c rdkafka_roundrobin_assignor.c -o rdkafka_roundrobin_assignor.o
gcc -MD -MP -g -O2 -fPIC -Wall -Wsign-compare -Wfloat-equal -Wpointer-arith -Wcast-align  -c rdkafka_feature.c -o rdkafka_feature.o
gcc -MD -MP -g -O2 -fPIC -Wall -Wsign-compare -Wfloat-equal -Wpointer-arith -Wcast-align  -c rdcrc32.c -o rdcrc32.o
gcc -MD -MP -g -O2 -fPIC -Wall -Wsign-compare -Wfloat-equal -Wpointer-arith -Wcast-align  -c crc32c.c -o crc32c.o
gcc -MD -MP -g -O2 -fPIC -Wall -Wsign-compare -Wfloat-equal -Wpointer-arith -Wcast-align  -c rdmurmur2.c -o rdmurmur2.o
gcc -MD -MP -g -O2 -fPIC -Wall -Wsign-compare -Wfloat-equal -Wpointer-arith -Wcast-align  -c rdaddr.c -o rdaddr.o
gcc -MD -MP -g -O2 -fPIC -Wall -Wsign-compare -Wfloat-equal -Wpointer-arith -Wcast-align  -c rdrand.c -o rdrand.o
gcc -MD -MP -g -O2 -fPIC -Wall -Wsign-compare -Wfloat-equal -Wpointer-arith -Wcast-align  -c rdlist.c -o rdlist.o
gcc -MD -MP -g -O2 -fPIC -Wall -Wsign-compare -Wfloat-equal -Wpointer-arith -Wcast-align  -c tinycthread.c -o tinycthread.o
gcc -MD -MP -g -O2 -fPIC -Wall -Wsign-compare -Wfloat-equal -Wpointer-arith -Wcast-align  -c rdlog.c -o rdlog.o
gcc -MD -MP -g -O2 -fPIC -Wall -Wsign-compare -Wfloat-equal -Wpointer-arith -Wcast-align  -c rdstring.c -o rdstring.o
gcc -MD -MP -g -O2 -fPIC -Wall -Wsign-compare -Wfloat-equal -Wpointer-arith -Wcast-align  -c rdkafka_event.c -o rdkafka_event.o
gcc -MD -MP -g -O2 -fPIC -Wall -Wsign-compare -Wfloat-equal -Wpointer-arith -Wcast-align  -c rdkafka_metadata.c -o rdkafka_metadata.o
gcc -MD -MP -g -O2 -fPIC -Wall -Wsign-compare -Wfloat-equal -Wpointer-arith -Wcast-align  -c rdregex.c -o rdregex.o
gcc -MD -MP -g -O2 -fPIC -Wall -Wsign-compare -Wfloat-equal -Wpointer-arith -Wcast-align  -c rdports.c -o rdports.o
gcc -MD -MP -g -O2 -fPIC -Wall -Wsign-compare -Wfloat-equal -Wpointer-arith -Wcast-align  -c rdkafka_metadata_cache.c -o rdkafka_metadata_cache.o
gcc -MD -MP -g -O2 -fPIC -Wall -Wsign-compare -Wfloat-equal -Wpointer-arith -Wcast-align  -c rdavl.c -o rdavl.o
gcc -MD -MP -g -O2 -fPIC -Wall -Wsign-compare -Wfloat-equal -Wpointer-arith -Wcast-align  -c rdkafka_sasl.c -o rdkafka_sasl.o
gcc -MD -MP -g -O2 -fPIC -Wall -Wsign-compare -Wfloat-equal -Wpointer-arith -Wcast-align  -c rdkafka_sasl_plain.c -o rdkafka_sasl_plain.o
gcc -MD -MP -g -O2 -fPIC -Wall -Wsign-compare -Wfloat-equal -Wpointer-arith -Wcast-align  -c rdkafka_interceptor.c -o rdkafka_interceptor.o
gcc -MD -MP -g -O2 -fPIC -Wall -Wsign-compare -Wfloat-equal -Wpointer-arith -Wcast-align  -c rdkafka_msgset_writer.c -o rdkafka_msgset_writer.o
gcc -MD -MP -g -O2 -fPIC -Wall -Wsign-compare -Wfloat-equal -Wpointer-arith -Wcast-align  -c rdkafka_msgset_reader.c -o rdkafka_msgset_reader.o
gcc -MD -MP -g -O2 -fPIC -Wall -Wsign-compare -Wfloat-equal -Wpointer-arith -Wcast-align  -c rdkafka_header.c -o rdkafka_header.o
gcc -MD -MP -g -O2 -fPIC -Wall -Wsign-compare -Wfloat-equal -Wpointer-arith -Wcast-align  -c rdvarint.c -o rdvarint.o
gcc -MD -MP -g -O2 -fPIC -Wall -Wsign-compare -Wfloat-equal -Wpointer-arith -Wcast-align  -c rdbuf.c -o rdbuf.o
gcc -MD -MP -g -O2 -fPIC -Wall -Wsign-compare -Wfloat-equal -Wpointer-arith -Wcast-align  -c rdunittest.c -o rdunittest.o
gcc -MD -MP -g -O2 -fPIC -Wall -Wsign-compare -Wfloat-equal -Wpointer-arith -Wcast-align  -c rdkafka_sasl_cyrus.c -o rdkafka_sasl_cyrus.o
gcc -MD -MP -g -O2 -fPIC -Wall -Wsign-compare -Wfloat-equal -Wpointer-arith -Wcast-align  -c rdkafka_sasl_scram.c -o rdkafka_sasl_scram.o
gcc -MD -MP -g -O2 -fPIC -Wall -Wsign-compare -Wfloat-equal -Wpointer-arith -Wcast-align  -c snappy.c -o snappy.o
gcc -MD -MP -g -O2 -fPIC -Wall -Wsign-compare -Wfloat-equal -Wpointer-arith -Wcast-align  -c rdkafka_lz4.c -o rdkafka_lz4.o
gcc -MD -MP -g -O2 -fPIC -Wall -Wsign-compare -Wfloat-equal -Wpointer-arith -Wcast-align  -O3 -c xxhash.c -o xxhash.o
gcc -MD -MP -g -O2 -fPIC -Wall -Wsign-compare -Wfloat-equal -Wpointer-arith -Wcast-align  -O3 -c lz4.c -o lz4.o
gcc -MD -MP -g -O2 -fPIC -Wall -Wsign-compare -Wfloat-equal -Wpointer-arith -Wcast-align  -O3 -c lz4frame.c -o lz4frame.o
gcc -MD -MP -g -O2 -fPIC -Wall -Wsign-compare -Wfloat-equal -Wpointer-arith -Wcast-align  -O3 -c lz4hc.c -o lz4hc.o
gcc -MD -MP -g -O2 -fPIC -Wall -Wsign-compare -Wfloat-equal -Wpointer-arith -Wcast-align  -c rddl.c -o rddl.o
gcc -MD -MP -g -O2 -fPIC -Wall -Wsign-compare -Wfloat-equal -Wpointer-arith -Wcast-align  -c rdkafka_plugin.c -o rdkafka_plugin.o
Generating linker script librdkafka.lds from rdkafka.h
Creating shared library librdkafka.so.1
gcc  -shared -Wl,-soname,librdkafka.so.1 -Wl,--version-script=librdkafka.lds rdkafka.o rdkafka_broker.o rdkafka_msg.o rdkafka_topic.o rdkafka_conf.o rdkafka_timer.o rdkafka_offset.o rdkafka_transport.o rdkafka_buf.o rdkafka_queue.o rdkafka_op.o rdkafka_request.o rdkafka_cgrp.o rdkafka_pattern.o rdkafka_partition.o rdkafka_subscription.o rdkafka_assignor.o rdkafka_range_assignor.o rdkafka_roundrobin_assignor.o rdkafka_feature.o rdcrc32.o crc32c.o rdmurmur2.o rdaddr.o rdrand.o rdlist.o tinycthread.o rdlog.o rdstring.o rdkafka_event.o rdkafka_metadata.o rdregex.o rdports.o rdkafka_metadata_cache.o rdavl.o rdkafka_sasl.o rdkafka_sasl_plain.o rdkafka_interceptor.o rdkafka_msgset_writer.o rdkafka_msgset_reader.o rdkafka_header.o rdvarint.o rdbuf.o rdunittest.o rdkafka_sasl_cyrus.o rdkafka_sasl_scram.o snappy.o rdkafka_lz4.o xxhash.o lz4.o lz4frame.o lz4hc.o rddl.o rdkafka_plugin.o -o librdkafka.so.1 -lsasl2 -lssl -lcrypto -ldl -lpthread -lrt
Creating static library librdkafka.a
ar rcs librdkafka.a rdkafka.o rdkafka_broker.o rdkafka_msg.o rdkafka_topic.o rdkafka_conf.o rdkafka_timer.o rdkafka_offset.o rdkafka_transport.o rdkafka_buf.o rdkafka_queue.o rdkafka_op.o rdkafka_request.o rdkafka_cgrp.o rdkafka_pattern.o rdkafka_partition.o rdkafka_subscription.o rdkafka_assignor.o rdkafka_range_assignor.o rdkafka_roundrobin_assignor.o rdkafka_feature.o rdcrc32.o crc32c.o rdmurmur2.o rdaddr.o rdrand.o rdlist.o tinycthread.o rdlog.o rdstring.o rdkafka_event.o rdkafka_metadata.o rdregex.o rdports.o rdkafka_metadata_cache.o rdavl.o rdkafka_sasl.o rdkafka_sasl_plain.o rdkafka_interceptor.o rdkafka_msgset_writer.o rdkafka_msgset_reader.o rdkafka_header.o rdvarint.o rdbuf.o rdunittest.o rdkafka_sasl_cyrus.o rdkafka_sasl_scram.o snappy.o rdkafka_lz4.o xxhash.o lz4.o lz4frame.o lz4hc.o rddl.o rdkafka_plugin.o
Creating librdkafka.so symlink
rm -f "librdkafka.so" && ln -s "librdkafka.so.1" "librdkafka.so"
Generating pkg-config file rdkafka.pc
Generating pkg-config file rdkafka-static.pc
Checking librdkafka integrity
librdkafka.so.1                OK
librdkafka.a                   OK
Symbol visibility              OK
make[1]: Leaving directory '/librdkafka-0.11.4/src'
make[1]: Entering directory '/librdkafka-0.11.4/src-cpp'
g++ -MD -MP -g -O2 -fPIC -Wall -Wsign-compare -Wfloat-equal -Wpointer-arith -Wcast-align -Wno-non-virtual-dtor -c RdKafka.cpp -o RdKafka.o
g++ -MD -MP -g -O2 -fPIC -Wall -Wsign-compare -Wfloat-equal -Wpointer-arith -Wcast-align -Wno-non-virtual-dtor -c ConfImpl.cpp -o ConfImpl.o
g++ -MD -MP -g -O2 -fPIC -Wall -Wsign-compare -Wfloat-equal -Wpointer-arith -Wcast-align -Wno-non-virtual-dtor -c HandleImpl.cpp -o HandleImpl.o
g++ -MD -MP -g -O2 -fPIC -Wall -Wsign-compare -Wfloat-equal -Wpointer-arith -Wcast-align -Wno-non-virtual-dtor -c ConsumerImpl.cpp -o ConsumerImpl.o
g++ -MD -MP -g -O2 -fPIC -Wall -Wsign-compare -Wfloat-equal -Wpointer-arith -Wcast-align -Wno-non-virtual-dtor -c ProducerImpl.cpp -o ProducerImpl.o
g++ -MD -MP -g -O2 -fPIC -Wall -Wsign-compare -Wfloat-equal -Wpointer-arith -Wcast-align -Wno-non-virtual-dtor -c KafkaConsumerImpl.cpp -o KafkaConsumerImpl.o
g++ -MD -MP -g -O2 -fPIC -Wall -Wsign-compare -Wfloat-equal -Wpointer-arith -Wcast-align -Wno-non-virtual-dtor -c TopicImpl.cpp -o TopicImpl.o
g++ -MD -MP -g -O2 -fPIC -Wall -Wsign-compare -Wfloat-equal -Wpointer-arith -Wcast-align -Wno-non-virtual-dtor -c TopicPartitionImpl.cpp -o TopicPartitionImpl.o
g++ -MD -MP -g -O2 -fPIC -Wall -Wsign-compare -Wfloat-equal -Wpointer-arith -Wcast-align -Wno-non-virtual-dtor -c MessageImpl.cpp -o MessageImpl.o
g++ -MD -MP -g -O2 -fPIC -Wall -Wsign-compare -Wfloat-equal -Wpointer-arith -Wcast-align -Wno-non-virtual-dtor -c QueueImpl.cpp -o QueueImpl.o
g++ -MD -MP -g -O2 -fPIC -Wall -Wsign-compare -Wfloat-equal -Wpointer-arith -Wcast-align -Wno-non-virtual-dtor -c MetadataImpl.cpp -o MetadataImpl.o
Creating shared library librdkafka++.so.1
gcc  -shared -Wl,-soname,librdkafka++.so.1 RdKafka.o ConfImpl.o HandleImpl.o ConsumerImpl.o ProducerImpl.o KafkaConsumerImpl.o TopicImpl.o TopicPartitionImpl.o MessageImpl.o QueueImpl.o MetadataImpl.o -o librdkafka++.so.1 -L../src -lrdkafka -lstdc++
Creating static library librdkafka++.a
ar rcs librdkafka++.a RdKafka.o ConfImpl.o HandleImpl.o ConsumerImpl.o ProducerImpl.o KafkaConsumerImpl.o TopicImpl.o TopicPartitionImpl.o MessageImpl.o QueueImpl.o MetadataImpl.o
Creating librdkafka++.so symlink
rm -f "librdkafka++.so" && ln -s "librdkafka++.so.1" "librdkafka++.so"
Generating pkg-config file rdkafka++.pc
Generating pkg-config file rdkafka++-static.pc
Checking librdkafka++ integrity
librdkafka++.so.1              OK
librdkafka++.a                 OK
make[1]: Leaving directory '/librdkafka-0.11.4/src-cpp'
make -C examples
make[1]: Entering directory '/librdkafka-0.11.4/examples'
gcc -g -O2 -fPIC -Wall -Wsign-compare -Wfloat-equal -Wpointer-arith -Wcast-align  -I../src rdkafka_example.c -o rdkafka_example  \
	../src/librdkafka.a -lsasl2 -lssl -lcrypto -ldl -lpthread -lrt
# rdkafka_example is ready
#
# Run producer (write messages on stdin)
./rdkafka_example -P -t <topic> -p <partition>

# or consumer
./rdkafka_example -C -t <topic> -p <partition>

#
# More usage options:
./rdkafka_example -h
gcc -g -O2 -fPIC -Wall -Wsign-compare -Wfloat-equal -Wpointer-arith -Wcast-align  -I../src rdkafka_performance.c -o rdkafka_performance  \
	../src/librdkafka.a -lsasl2 -lssl -lcrypto -ldl -lpthread -lrt
# rdkafka_performance is ready
#
# Run producer
./rdkafka_performance -P -t <topic> -p <partition> -s <msgsize>

# or consumer
./rdkafka_performance -C -t <topic> -p <partition>

#
# More usage options:
./rdkafka_performance -h
g++ -g -O2 -fPIC -Wall -Wsign-compare -Wfloat-equal -Wpointer-arith -Wcast-align -Wno-non-virtual-dtor -I../src-cpp rdkafka_example.cpp -o rdkafka_example_cpp  \
	../src-cpp/librdkafka++.a ../src/librdkafka.a -lsasl2 -lssl -lcrypto -ldl -lpthread -lrt -lstdc++
gcc -g -O2 -fPIC -Wall -Wsign-compare -Wfloat-equal -Wpointer-arith -Wcast-align  -I../src rdkafka_consumer_example.c -o rdkafka_consumer_example  \
	../src/librdkafka.a -lsasl2 -lssl -lcrypto -ldl -lpthread -lrt
# rdkafka_consumer_example is ready
#
./rdkafka_consumer_example <topic[:part]> <topic2[:part]> ..

#
# More usage options:
./rdkafka_consumer_example -h
g++ -g -O2 -fPIC -Wall -Wsign-compare -Wfloat-equal -Wpointer-arith -Wcast-align -Wno-non-virtual-dtor -I../src-cpp rdkafka_consumer_example.cpp -o rdkafka_consumer_example_cpp  \
	../src-cpp/librdkafka++.a ../src/librdkafka.a -lsasl2 -lssl -lcrypto -ldl -lpthread -lrt -lstdc++
g++ -g -O2 -fPIC -Wall -Wsign-compare -Wfloat-equal -Wpointer-arith -Wcast-align -Wno-non-virtual-dtor -I../src-cpp kafkatest_verifiable_client.cpp -o kafkatest_verifiable_client  \
	../src-cpp/librdkafka++.a ../src/librdkafka.a -lsasl2 -lssl -lcrypto -ldl -lpthread -lrt -lstdc++
gcc -g -O2 -fPIC -Wall -Wsign-compare -Wfloat-equal -Wpointer-arith -Wcast-align  -I../src rdkafka_simple_producer.c -o rdkafka_simple_producer  \
	../src/librdkafka.a -lsasl2 -lssl -lcrypto -ldl -lpthread -lrt
make[1]: Leaving directory '/librdkafka-0.11.4/examples'
Updating
CONFIGURATION.md CONFIGURATION.md.tmp differ: char 330, line 6
Checking  integrity
CONFIGURATION.md               OK
examples/rdkafka_example       OK
examples/rdkafka_performance   OK
examples/rdkafka_example_cpp   OK
make[1]: Entering directory '/librdkafka-0.11.4/src'
Checking librdkafka integrity
librdkafka.so.1                OK
librdkafka.a                   OK
Symbol visibility              OK
make[1]: Leaving directory '/librdkafka-0.11.4/src'
make[1]: Entering directory '/librdkafka-0.11.4/src-cpp'
Creating shared library librdkafka++.so.1
gcc  -shared -Wl,-soname,librdkafka++.so.1 RdKafka.o ConfImpl.o HandleImpl.o ConsumerImpl.o ProducerImpl.o KafkaConsumerImpl.o TopicImpl.o TopicPartitionImpl.o MessageImpl.o QueueImpl.o MetadataImpl.o -o librdkafka++.so.1 -L../src -lrdkafka -lstdc++
Checking librdkafka++ integrity
librdkafka++.so.1              OK
librdkafka++.a                 OK
make[1]: Leaving directory '/librdkafka-0.11.4/src-cpp'
make[1]: Entering directory '/librdkafka-0.11.4/src'
Install librdkafka to /usr/local
install -d $DESTDIR/usr/local/include/librdkafka ; \
install -d $DESTDIR/usr/local/lib ; \
install rdkafka.h $DESTDIR/usr/local/include/librdkafka ; \
install librdkafka.a $DESTDIR/usr/local/lib ; \
install librdkafka.so.1 $DESTDIR/usr/local/lib ; \
[ -f "rdkafka.pc" ] && ( \
	install -d $DESTDIR/usr/local/lib/pkgconfig ; \
	install -m 0644 rdkafka.pc $DESTDIR/usr/local/lib/pkgconfig \
) ; \
[ -f "rdkafka-static.pc" ] && ( \
	install -d $DESTDIR/usr/local/lib/pkgconfig ; \
	install -m 0644 rdkafka-static.pc $DESTDIR/usr/local/lib/pkgconfig \
) ; \
(cd $DESTDIR/usr/local/lib && ln -sf librdkafka.so.1 librdkafka.so)
make[1]: Leaving directory '/librdkafka-0.11.4/src'
make[1]: Entering directory '/librdkafka-0.11.4/src-cpp'
Install librdkafka++ to /usr/local
install -d $DESTDIR/usr/local/include/librdkafka ; \
install -d $DESTDIR/usr/local/lib ; \
install rdkafkacpp.h $DESTDIR/usr/local/include/librdkafka ; \
install librdkafka++.a $DESTDIR/usr/local/lib ; \
install librdkafka++.so.1 $DESTDIR/usr/local/lib ; \
[ -f "rdkafka++.pc" ] && ( \
	install -d $DESTDIR/usr/local/lib/pkgconfig ; \
	install -m 0644 rdkafka++.pc $DESTDIR/usr/local/lib/pkgconfig \
) ; \
[ -f "rdkafka++-static.pc" ] && ( \
	install -d $DESTDIR/usr/local/lib/pkgconfig ; \
	install -m 0644 rdkafka++-static.pc $DESTDIR/usr/local/lib/pkgconfig \
) ; \
(cd $DESTDIR/usr/local/lib && ln -sf librdkafka++.so.1 librdkafka++.so)
make[1]: Leaving directory '/librdkafka-0.11.4/src-cpp'
 ---> cca7609e23f1

@edenhill
Copy link
Contributor

The librdkafka build looks fine, it is picking up libsasl2 for GSSAPI support.

I think the problem might be that Confluent.Kafka depends on the librdkafka.redist NuGet package which perhaps is not built with SASL support for your platform, you can override which librdkafka library to load by doing:
Confluent.Kafka.Library.Load("/usr/local/lib/librdkafka.so");

@ikyriakidis
Copy link
Author

It is working now however by using Confluent.Kafka.Library.Load("/opt/cons/bin/librdkafka.so"); i was getting an exception of Failed to load the librdkafka native library. even though the librdkafka.so was on the directory.

I noticed that under /opt/cons/bin/Qliro.Simple.Consumer/runtimes/linux-x64/native there were two files.

debian9-librdkafka.so
librdkafka.so

When I tried to use the librdkafka.so i got an exception of No provider for SASL mechanism GSSAPI error, so i deleted librdkafka.so and copy my librdkafka.so to the directory. Everything start working normally.

@edenhill
Copy link
Contributor

Library.Load will fail for an existing library if the library's dependencies are unmet.

@mhowlett
Copy link
Contributor

I documented a similar issue on macos over in #570 - i thought this was specific to macos, but maybe something has changed in .NET Core. I was seeing the librdkafka in the runtimes folder loaded even if an absolute path is specified in Library.Load (to somewhere else) and even if I rename my custom librdkafka build something else. It seems as though .NET Core is super aggressively prioritizing the runtimes folder over everything else. This is high on the priority list to get to the bottom of, but there are things higher, e.g. getting the 1.0 API finalized.

The workaround at the moment is to overwrite the librdkafka.so in librdkafka.redist or remove the librdkafka.redist dependency on Confluent.Kafka, recompile, and reference that.

@mhowlett mhowlett added the bug label Jul 23, 2018
@mhowlett
Copy link
Contributor

I believe this is the same issue as #570, closing in favor of that.

@mhowlett mhowlett added the investigate further we want to further investigate to understand properly label Jan 11, 2019
@mhowlett mhowlett reopened this Jan 11, 2019
@gmakin
Copy link

gmakin commented Jan 14, 2019

Hi @mhowlett
I'm using .NET Confluent library, I'm also facing similar issue.

I also looked at #550
thread and based of comment from srininz77

"I made it work by using https://hub.docker.com/r/confluentinc/cp-kafka-connect/ and installing dot net core 2.1 runtime inside the container. I don’t know what’s missing in Microsoft’s dot net 2.1 runtime image."

I created the docker image with above recommendation based of kafka-connect, But Now I'm not facing the same issue but I'm facing below issue, here are the snippet from logs :

[thrd:sasl_plaintext://BROKER1:6667/bootst]: sasl_plaintext://BROKER1:6667/bootstrap: GSSAPI Error: Unspecified GSS failure. Minor code may provide more information (Matching credential not found)

===================================

7|2019-01-14 20:58:05.369|rdkafka#consumer-1|SASLMECHS| [thrd:sasl_plaintext://BROKER1:6667/bootst]: sasl_plaintext://BROKER1:6667/bootstrap: Broker supported SASL mechanisms: GSSAPI
7|2019-01-14 20:58:05.369|rdkafka#consumer-1|AUTH| [thrd:sasl_plaintext://BROKER1:6667/bootst]: sasl_plaintext://BROKER1:6667/bootstrap: Auth in state AUTH_HANDSHAKE (handshake supported)
7|2019-01-14 20:58:05.369|rdkafka#consumer-1|STATE| [thrd:sasl_plaintext://BROKER1:6667/bootst]: sasl_plaintext://BROKER1:6667/bootstrap: Broker changed state AUTH_HANDSHAKE -> AUTH
7|2019-01-14 20:58:05.369|rdkafka#consumer-1|BROADCAST| [thrd:sasl_plaintext://BROKER1:6667/bootst]: Broadcasting state change
7|2019-01-14 20:58:05.369|rdkafka#consumer-1|SASL| [thrd:sasl_plaintext://BROKER1:6667/bootst]: sasl_plaintext://BROKER1:6667/bootstrap: Initializing SASL client: service name svc_hdfdev_kafka, hostname BROKER1, mechanisms GSSAPI, provider Cyrus
7|2019-01-14 20:58:05.369|rdkafka#consumer-1|SASLREFRESH| [thrd:sasl_plaintext://BROKER1:6667/bootst]: sasl_plaintext://BROKER1:6667/bootstrap: Refreshing SASL keys with command: kinit -S "svc_hdfdev_kafka/BROKER1" -k -t "/etc/config/kafka.service.keytab" svc_hdfdev_kafka/BROKER1@ALTAIRCICD.MDTDEV.COM
7|2019-01-14 20:58:05.393|rdkafka#consumer-1|SASLREFRESH| [thrd:sasl_plaintext://BROKER1:6667/bootst]: sasl_plaintext://BROKER1:6667/bootstrap: SASL key refreshed
7|2019-01-14 20:58:05.393|rdkafka#consumer-1|SASL| [thrd:sasl_plaintext://BROKER1:6667/bootst]: sasl_plaintext://BROKER1:6667/bootstrap: My supported SASL mechanisms: GS2-IAKERB GS2-KRB5 SCRAM-SHA-1 GSSAPI GSS-SPNEGO DIGEST-MD5 EXTERNAL CRAM-MD5 NTLM PLAIN LOGIN ANONYMOUS
2|2019-01-14 20:58:05.396|rdkafka#consumer-1|LIBSASL| [thrd:sasl_plaintext://BROKER1:6667/bootst]: sasl_plaintext://BROKER1:6667/bootstrap: GSSAPI Error: Unspecified GSS failure. Minor code may provide more information (Matching credential not found)
7|2019-01-14 20:58:05.396|rdkafka#consumer-1|BROKERFAIL| [thrd:sasl_plaintext://BROKER1:6667/bootst]: sasl_plaintext://BROKER1:6667/bootstrap: failed: err: Local: Authentication failure: (errno: Invalid argument)
7|2019-01-14 20:58:05.396|rdkafka#consumer-1|STATE| [thrd:sasl_plaintext://BROKER1:6667/bootst]: sasl_plaintext://BROKER1:6667/bootstrap: Broker changed state AUTH -> DOWN
7|2019-01-14 20:58:05.396|rdkafka#consumer-1|BROADCAST| [thrd:sasl_plaintext://BROKER1:6667/bootst]: Broadcasting state change

======================

Here are the config settings
"security.protocol", "SASL_PLAINTEXT";
"sasl.mechanisms", "GSSAPI";
"debug", "all"
"sasl.kerberos.principal", "svc_hdfdev_kafka/BROKER1@DOMAINXX.COM");
"sasl.kerberos.keytab", kafkakrb5Config;
sasl.kerberos.service.name", "svc_hdfdev_kafka;

Below is the only workaround available?
The workaround at the moment is to overwrite the librdkafka.so in librdkafka.redist or remove the librdkafka.redist dependency on Confluent.Kafka, recompile, and reference that.

Is there any workaround or patch available?

@srininz77: If possible, Can you please share your Docker file for above recommendation?

@ulkas
Copy link

ulkas commented Mar 30, 2021

solved in docker by installing librdkafka and confluent kafka from sources:

ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get clean; apt-get update --allow-unauthenticated --allow-insecure-repositories;   apt-get install -y libsasl2-modules-gssapi-mit libsasl2-dev libssl-dev openssl ;  apt-get  install -yqq krb5-user libpam-krb5; mkdir tmp; cd tmp; git clone --depth 1 -b v1.6.1 https://github.com/edenhill/librdkafka.git; cd librdkafka;git tag; ./configure; make; make install;  ldconfig; cd .. ; rm -Rf tmp/*; apt-get autoremove -y; apt-get clean; exit 0
...
RUN pip3 install vendor/confluent-kafka-1.6.1.tar.gz

@nmp36
Copy link

nmp36 commented Feb 26, 2022

Hello,
I am facing similar issue.Please help.
An exception of type 'System.InvalidOperationException' occurred in Confluent.Kafka.dll but was not handled in user code: 'No provider for SASL mechanism GSSAPI: recompile librdkafka with libsasl2 or openssl support. Current build options: PLAIN SASL_SCRAM'

I have tried downloading openssl , yum install cyrus-sasl-gssapi cyrus-sasl-devel. I have windows 10 ,net6.0 and building kafka client.I deployed it on openshit.

@github-yuvo
Copy link

Seems this issue is still happening with .Net 6 and using Confluent.Kafka Library, The Workaround above is still the only option?

@github-yuvo
Copy link

COPY ./lib/ /

in your Dockerfile what does the above statement refer to, what is the ./lib content

@station72
Copy link

Hello, I am facing similar issue.Please help. An exception of type 'System.InvalidOperationException' occurred in Confluent.Kafka.dll but was not handled in user code: 'No provider for SASL mechanism GSSAPI: recompile librdkafka with libsasl2 or openssl support. Current build options: PLAIN SASL_SCRAM'

I have tried downloading openssl , yum install cyrus-sasl-gssapi cyrus-sasl-devel. I have windows 10 ,net6.0 and building kafka client.I deployed it on openshit.

Hello! Did you solve this issue?

@anchitj
Copy link
Member

anchitj commented Jun 25, 2024

Is this still an issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug investigate further we want to further investigate to understand properly
Projects
None yet
Development

No branches or pull requests

10 participants