question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

node-rdkafka 2.3.0 Segmentation fault

See original GitHub issue

Since 2.3.0, as soon as connect() method is called (from consumer or producer), a Segmentation fault occured.

Steps to reproduce using docker and e2e tests for brevity :

Dockerfile :

FROM node:9-stretch
RUN npm i node-rdkafka
WORKDIR /node_modules/node-rdkafka
RUN npm i
ENV KAFKA_HOST=localhost:29092

e2e tests run :

$ docker build -t rdkafka .
(...)

$ docker run --net host rdkafka make e2e
  Consumer
    commit
Makefile:63: recipe for target 'e2e' failed
make: *** [e2e] Segmentation fault (core dumped)

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:4
  • Comments:17 (6 by maintainers)

github_iconTop GitHub Comments

14reactions
tvainikacommented, Mar 30, 2018

The problem here is that librdkafka built is not used inside node module, because node module links against system librdkafka, not the local librdkafka. And system’s librdkafka is usually linked against OpenSSL 1.1 but node is built against OpenSSL 1.0, and this causes the segmentation fault. See PR #388 for the fix.

Also in Debian, you should make sure that you have libssl1.0-dev installed, not libssl-dev (1.1) so that npm builds librdkafka correctly against OpenSSL 1.0.

2reactions
ankoncommented, Mar 19, 2018

On Fedora x86_64, with node 8.9.4 and suitable debug parts enabled (Ugh!):

Thread 10 "node" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fffe6108700 (LWP 3481)]
__strcmp_sse2_unaligned () at ../sysdeps/x86_64/multiarch/strcmp-sse2-unaligned.S:31
31		movdqu	(%rdi), %xmm1
(gdb) where
#0  __strcmp_sse2_unaligned () at ../sysdeps/x86_64/multiarch/strcmp-sse2-unaligned.S:31
#1  0x0000000000994b9a in lh_insert ()
#2  0x00000000009a0081 in OBJ_NAME_add ()
#3  0x00007fffe7938841 in ossl_init_ssl_base () at ssl/ssl_init.c:72
#4  ossl_init_ssl_base_ossl_ () at ssl/ssl_init.c:25
#5  0x00007ffff6ed4227 in __pthread_once_slow (once_control=0x7fffe7b77c3c <ssl_base>, init_routine=0x7fffe7938600 <ossl_init_ssl_base_ossl_>) at pthread_once.c:116
#6  0x00007ffff6ed42e5 in __GI___pthread_once (once_control=once_control@entry=0x7fffe7b77c3c <ssl_base>, init_routine=init_routine@entry=0x7fffe7938600 <ossl_init_ssl_base_ossl_>) at pthread_once.c:143
#7  0x00007fffe7d2d779 in CRYPTO_THREAD_run_once (once=once@entry=0x7fffe7b77c3c <ssl_base>, init=init@entry=0x7fffe7938600 <ossl_init_ssl_base_ossl_>) at crypto/threads_pthread.c:106
#8  0x00007fffe793897b in OPENSSL_init_ssl (opts=opts@entry=2097154, settings=settings@entry=0x0) at ssl/ssl_init.c:227
#9  0x00007ffff43fb13d in rd_kafka_transport_ssl_init () at rdkafka_transport.c:481
#10 0x00007ffff43d811a in rd_kafka_global_cnt_incr () at rdkafka.c:134
#11 rd_kafka_new (type=type@entry=RD_KAFKA_CONSUMER, app_conf=0x7fffd4000b90, errstr=errstr@entry=0x7fffe6107b70 "", errstr_size=errstr_size@entry=512) at rdkafka.c:1319
#12 0x00007ffff46c0960 in RdKafka::KafkaConsumer::create (conf=<optimized out>, errstr="") at KafkaConsumerImpl.cpp:63
#13 0x00007ffff48f036e in NodeKafka::KafkaConsumer::Connect() () from /home/andreas/project/collaborne-event-stream-library/node_modules/node-rdkafka/build/Release/node-librdkafka.node
#14 0x00007ffff48fd847 in NodeKafka::Workers::KafkaConsumerConnect::Execute() () from /home/andreas/project/collaborne-event-stream-library/node_modules/node-rdkafka/build/Release/node-librdkafka.node
#15 0x00007ffff48edcf2 in Nan::AsyncExecute(uv_work_s*) () from /home/andreas/project/collaborne-event-stream-library/node_modules/node-rdkafka/build/Release/node-librdkafka.node
#16 0x000000000143c001 in worker (arg=<optimized out>) at ../deps/uv/src/threadpool.c:83
#17 0x00007ffff6ecc50b in start_thread (arg=0x7fffe6108700) at pthread_create.c:465
#18 0x00007ffff6c0416f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

I’m using a non-SSL connection to a local kafka broker, but from what I understand this is generic SSL-support code initialization?

EDIT: On a whim I modified node_modules/node-rdkafka/configure in my project, added --disable-ssl, and executed npm rebuild. This fixes the immediate problem, and I can work again.

Read more comments on GitHub >

github_iconTop Results From Across the Web

node-rdkafka is throwing segmentation fault - Stack Overflow
I have tried two version's of node-rdkafka (2.10.0 & 2.10.1). Both the versions are throwing segmentation fault while deployment.
Read more >
Understanding NodeJS, Kafka, and SSL - and1zero
Segmentation fault is an error thrown by program written in C / C++ in order to avoid memory corruption. In our application's case,...
Read more >
https://213.136.78.173/krish/node-kafka/commit/39d...
versionString) { + console.error(`Librdkafka version of ${versionString} does not match package json: ... Requires broker version >= 2.3.0.
Read more >
Server Admin Log/Archive 32 - Wikitech-static
... to apt.wikimedia.org (addresses segfault in XML reader (T162586, T165074) ... 10:07 hashar: Upgrading Jenkins "Git client" plugin 2.3.0..2.4.1 and ...
Read more >
subject:"Re\: Jira" - The Mail Archive
Re: [jira] [Created] (KAFKA-14257) Unexpected error ... 2.0.1, >> 2.1.0, 2.2.0, 2.1.1, 2.3.0, 2.2.1, 2.2.2, 2.4.0, 2.3.1, 2.5.0, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found