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

Docker Container not running with node-rdkafka and librdkafka #3691

Open
7 tasks done
abbey007 opened this issue Jan 28, 2022 · 4 comments
Open
7 tasks done

Docker Container not running with node-rdkafka and librdkafka #3691

abbey007 opened this issue Jan 28, 2022 · 4 comments

Comments

@abbey007
Copy link

Description

I am using node-rdkafka to connect my application with kafka. When i am running the application using docker i am getting error Segmentation fault (core dumped)

I have used different combination of node images to resolve the issue.

How to reproduce

Attaching my DockerFile

FROM node:14.17.3

RUN npm cache clean --force
RUN apt-get update
RUN apt install -y liblz4-dev
RUN apt install -y libsasl2-dev
RUN apt install -y libssl-dev
RUN apt-get install -y ca-certificates curl gnupg
g++ make musl-dev
python3 unzip wget
git

RUN git clone https://github.com/edenhill/librdkafka.git &&
cd librdkafka &&
./configure --install-deps &&
make &&
make install

ENV BUILD_LIBRDKAFKA=0
ENV LD_LIBRARY_PATH=/usr/local/lib

RUN mkdir -p /home/node && chown -R node:node /home/node
ENV NODE_ENV=local
WORKDIR /home/node
COPY ["package.json", "./"]
RUN npm install husky -g
RUN npm install -g typescript
RUN npm install -g ts-node
RUN npm install
COPY . .
EXPOSE 4003
RUN chown -R node /home/node
USER node
RUN rm -rf dist
RUN tsc
CMD node dist/bin/server.js

Checklist

Please provide the following information:

  • librdkafka version (release number or git tag): v1.6.2
  • Apache Kafka version: 3.1.0
  • librdkafka client configuration: 'metadata.broker.list': this.#BROKER, 'group.id': process.env.SERVICE_NAME, 'enable.auto.commit': false
  • Operating system: ubuntu (x64)
  • Provide logs (with debug=.. as necessary) from librdkafka
  • Provide broker log excerpts
  • Critical issue
@edenhill
Copy link
Contributor

That is likely a node-rdkafka issue, please file an issue on that repo.
Also try upgrading to the latest version of librdkafka, and if still reproducible run the application in gdb and extract a backtrace (type bt in gdb) when it crashes.

@abbey007
Copy link
Author

I am reporting the issue on node-rdkafka as well, Also i am using https://github.com/edenhill/librdkafka.git which i supose using the latest version of librdkafka .
I have no idea how to run the application with gdb inside a container becasue i am not able to run container due to error.

@mreouven
Copy link

mreouven commented Nov 9, 2023

i have the same probleme
i get this error

[c] PID:1 - 11/09/2023, 8:39:02 PM LOG [Fi] Start application listening on group:find url: ["b**"]
[New Thread 0x7fffde1fc700 (LWP 50168)]
[New Thread 0x7fffdd7fb700 (LWP 50169)]
[New Thread 0x7fffdcdfa700 (LWP 50170)]
[New Thread 0x7ffd43fff700 (LWP 50171)]
[New Thread 0x7ffd435fe700 (LWP 50172)]
--Type for more, q to quit, c to continue without paging--bt

Thread 16 "rdk:broker-1" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7ffd435fe700 (LWP 50172)]
0x00007fffecff32a3 in SSL_get_peer_certificate () from /usr/lib/x86_64-linux-gnu/libssl.so.1.1

(gdb) bt
#0 0x00007fffecff32a3 in SSL_get_peer_certificate () from /usr/lib/x86_64-linux-gnu/libssl.so.1.1
Blizzard/node-rdkafka#1 0x00007fffed1fb409 in rd_kafka_transport_ssl_verify (rktrans=0x7ffd34005100) at rdkafka_ssl.c:582
Blizzard/node-rdkafka#2 rd_kafka_transport_ssl_handshake (rktrans=rktrans@entry=0x7ffd34005100) at rdkafka_ssl.c:620
Blizzard/node-rdkafka#3 0x00007fffed0c1190 in rd_kafka_transport_io_event (rktrans=rktrans@entry=0x7ffd34005100, events=events@entry=1,
socket_errstr=0x0) at rdkafka_transport.c:744
Blizzard/node-rdkafka#4 0x00007fffed0c1e6c in rd_kafka_transport_io_serve (rktrans=0x7ffd34005100, rkq=, timeout_ms=)
at rdkafka_transport.c:1047
Blizzard/node-rdkafka#5 0x00007fffed0a9fcc in rd_kafka_broker_ops_io_serve (rkb=rkb@entry=0x7ffd4c05bb50, abs_timeout=9630356814)
at rdkafka_broker.c:3568
Blizzard/node-rdkafka#6 0x00007fffed0aa4f3 in rd_kafka_broker_consumer_serve (rkb=rkb@entry=0x7ffd4c05bb50, abs_timeout=abs_timeout@entry=9630356814)
at rdkafka_broker.c:4271
Blizzard/node-rdkafka#7 0x00007fffed0aac89 in rd_kafka_broker_serve (rkb=rkb@entry=0x7ffd4c05bb50, timeout_ms=, timeout_ms@entry=1000)
at rdkafka_broker.c:4413
Blizzard/node-rdkafka#8 0x00007fffed0ab155 in rd_kafka_broker_thread_main (arg=0x7ffd4c05bb50) at rdkafka_broker.c:4561
Blizzard/node-rdkafka#9 0x00007ffff7c7af5a in start_thread (arg=) at pthread_create.c:474
Blizzard/node-rdkafka#10 0x00007ffff7b9aa2f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

the segmentation fault is occurring within the SSL_get_peer_certificate function from the libssl library.

@milindl
Copy link
Contributor

milindl commented Jul 23, 2024

I would suggest trying to use https://github.com/confluentinc/confluent-kafka-javascript which is compatible with node-rdkafka (and is based on it). It includes a precompiled version of librdkafka within which should have all the openssl dependencies built into it. I recall having to set ssl.ca.location while using node-rdkafka, maybe this is related. This isn't the case with confluent-kafka-javascript.

Example of a dockerfile using that: confluentinc/confluent-kafka-javascript#48 (comment)

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

4 participants