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

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

Closed
nick-zh opened this issue Sep 12, 2018 · 7 comments
Closed

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

nick-zh opened this issue Sep 12, 2018 · 7 comments

Comments

@nick-zh
Copy link
Contributor

nick-zh commented Sep 12, 2018

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

@nick-zh
Copy link
Contributor Author

nick-zh commented Sep 12, 2018

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.

@nick-zh nick-zh changed the title Failed to create thread: No error information (0) Failed to create thread: No error information (0) on alpine3.8 Sep 12, 2018
@edenhill
Copy link
Contributor

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.

@nick-zh
Copy link
Contributor Author

nick-zh commented Sep 17, 2018

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)

@edenhill
Copy link
Contributor

💯 for reproducible environment!

@edenhill
Copy link
Contributor

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.

@nick-zh
Copy link
Contributor Author

nick-zh commented Sep 18, 2018

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

@edenhill
Copy link
Contributor

Awesome, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants