Librdkafka: Failed to create thread: No error information (0) on alpine3.8

Created on 12 Sep 2018  路  7Comments  路  Source: edenhill/librdkafka

I am in a alpine 3.8 container and installing (make and make install) librdkafka 0.11.5.
When i am instantiating a new Producer (in php), i am getting:
Failed to create thread: No error information (0)
Any insight on why this might happen? With 0.11.4 it is working fine

GREAT REPORT

All 7 comments

So i was able to narrow it down, it seems that installing it this way:

git clone --depth 1 --branch v0.11.5 https://github.com/edenhill/librdkafka.git && \
cd librdkafka
./configure
make
make install

causes this to happen, when i install the package from edge:

apk add librdkafka librdkafka-dev --update-cache --repository http://dl-3.alpinelinux.org/alpine/edge/community

it seems to work. I leave it open for now @edenhill maybe you have some insight in why this might happen. If not, you can close it.

I don't see how the error information is lost.
pthread_create() fails here and sets errno:
https://github.com/edenhill/librdkafka/blob/master/src/tinycthread.c#L665

errno is printed from the caller, now with a value of 0, which shouldnt be possible:
https://github.com/edenhill/librdkafka/blob/master/src/rdkafka.c#L1734

Unless the free() at tinycthread.c line 676 resets the errno, which it shouldnt, and looking at the musl source it doesn't seem to do that unless syscall() does.

Hey @edenhill
So i was able to reproduce this, you can unpack my zip file and do a

docker-compose up
docker exec -it <fpm container id> sh
./setup.sh
php kafka_producer.php

debug.zip

So in my php file, when i remove this line:

$topicConfig->set('message.timeout.ms', 5000);

I get an error with information (i still dont get why though):

Uncaught RdKafka\Exception: Failed to create thread: Invalid seek (29)

If i leave it in, i will get no info on the error:

Uncaught RdKafka\Exception: Failed to create thread: No error information (0)

:100: for reproducible environment!

Found the issue: librdkafka's internal C11 threads (tinycthread) is mixed with the musl-provided C11 threads, causing weird errors and crashes.

We'll need to disable our own C11 threads implementation when a system one is available.

Hey @edenhill

I tested this on the latest master branch, everything looks good so far.
Thanks for the continued fast support, it's greatly appreciated!
I think this issue can be closed?

Cheers,
Nick

Awesome, thank you!

Was this page helpful?
0 / 5 - 0 ratings