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

when using librdkafka, create a thread will fail. #4654

Open
7 tasks done
hnlylyb opened this issue Mar 20, 2024 · 0 comments
Open
7 tasks done

when using librdkafka, create a thread will fail. #4654

hnlylyb opened this issue Mar 20, 2024 · 0 comments

Comments

@hnlylyb
Copy link

hnlylyb commented Mar 20, 2024

Description

when using librdkafka, use pthread to create a thread will be failed.

How to reproduce

#include <pthread.h>
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <librdkafka/rdkafka.h>
#include <librdkafka/rdkafkacpp.h>

static void* msec_thread(void*)
{
        return nullptr;
}

static void slack_init()
{
        int rc;
        pthread_attr_t attr;
        pthread_t thr;

        pthread_attr_init(&attr);
        pthread_attr_setstacksize(&attr, 16 * 1024);
        pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
        rc = pthread_create(&thr, &attr, msec_thread, NULL);
        pthread_attr_destroy(&attr);
        printf("rc:%d\n", rc);
}

int main(int argc, char **argv) 
{
        slack_init();
        RdKafka::Conf *conf = RdKafka::Conf::create(RdKafka::Conf::CONF_GLOBAL);
        delete conf;
        return 0;
}

using above code, it cannot create the thread, and print rc:22,
but if I comment the code about rdkafka, it will print rc:0.

Checklist

librdkafka version:
Operating system: ubuntu22.04

  • librdkafka version (release number or git tag): v2.3.0
  • Apache Kafka version: N/A
  • librdkafka client configuration: N/A
  • Operating system: ubuntu 22.04
  • Provide logs (with debug=.. as necessary) from librdkafka
  • Provide broker log excerpts
  • Critical issue
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

1 participant