Skip to content

Improper usage of Consumer constructor crashes python interpreter #37

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

Closed
aaronhays opened this issue Aug 24, 2016 · 5 comments
Closed
Assignees
Labels

Comments

@aaronhays
Copy link

If you call the Consumer constructor with no parameters, python segfaults.

Python 3.5.2 (default, Aug 16 2016, 08:16:10)
[GCC 4.8.3 20140911 (Red Hat 4.8.3-9)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import confluent_kafka
>>> c = confluent_kafka.Consumer()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: expected configuration dict
Fatal Python error: take_gil: NULL tstate
[1]    68631 abort (core dumped)  python

Note, that this only happens if there are strictly no parameters. Simply changing the constructor call to Consumer(**{}) avoids the crash.

Python 3.5.2 (default, Aug 16 2016, 08:16:10)
[GCC 4.8.3 20140911 (Red Hat 4.8.3-9)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import confluent_kafka
>>> c = confluent_kafka.Consumer(**{})
>>>
@edenhill edenhill added the bug label Aug 24, 2016
@edenhill edenhill self-assigned this Aug 24, 2016
@edenhill
Copy link
Contributor

There's actually already a test for this, that passes.
It only seems to crash when using the interactive REPL, not for scripts.

The crash is related to Py_DECREF(self); in the error path in Consumer_new(), still trying to figure out why.

@aaronhays
Copy link
Author

Interesting - I never actually tried this in a script. I was playing with it in the REPL to get a feeling for the minimal constructor while playing around with mocking out Consumer for unit tests.

@samarthg
Copy link

In my environment with python2.7, integration test "verify_consumer()" results in segmentation fault.

@edenhill
Copy link
Contributor

Fatal Python error: take_gil: NULL tstate

This only happens on Python 3, not on 2.7.

@edenhill
Copy link
Contributor

This is fixed on master

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

No branches or pull requests

3 participants