-
Notifications
You must be signed in to change notification settings - Fork 914
Producer not thread-safe #19
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
Comments
I'm on ubuntu 15.10 running Python 2.7.10 |
Hi @tbsf, did inclusion of PyEval_InitThreads() fix the issue? If not, can you provide a small script to reproduce the issue? Thanks |
No, It didn't fix it. I have a single thread reading from a kafka topic and writing out to other topics. It runs for a few seconds and crashes. Here is the backtrace from one of the errors if it helps: Fatal Python error: PyEval_RestoreThread: NULL tstate
This the backtrace for the other message: Fatal Python error: ceval: tstate mix-up
|
I'm using something like:
I think producer.flush() is what is causing the error. |
I tried reproducing this with the following snippet, but it works:
Can you reproduce it with that snippet? If not, what configuration are you passing to the Producer? |
I have a thread pool sharing a single producer, so it would be more like this (excuse the bad code, it may hang):
If I put a lock around producer.flush, it doesn't crash. |
This is the class CondfluentKafkaProducer:
|
by the way, is there a way to get the partition information in the producer so I can write my own partitioner? |
It looks like your code would call flush() from separate threads, which is probably the issue here since This will be fixed. |
Producer timestamp
I am receiving these errors frequently:
Fatal Python error: PyEval_RestoreThread: NULL tstate
Aborted (core dumped)
As well as
Fatal Python error: ceval: tstate mix-up
Aborted (core dumped)
Both cause core dumps.
I see one potential solution is to include PyEval_InitThreads(); before using threads, which I will try.
The text was updated successfully, but these errors were encountered: