Skip to content

TypeError: object of type 'NoneType' has no len() #1277

Closed
@rbrunhuber

Description

@rbrunhuber

After "fixing" bug #1276 for me I hit another error:

Environment:
•Kafka 0.10.0.2.6
•Kerberos 5 version 1.12.2 (MS AD server)
•Python 3.6.1 |Anaconda 4.4.0 (64-bit)
•kafka-python (1.3.6.dev0)
•gssapi (1.2.2)

Traceback (most recent call last):
  File "/home/myname/workspace/python/kafkatest/kafkatest.py", line 20, in <module>
    ,auto_offset_reset='earliest'
  File "/opt/continuum/anaconda3/lib/python3.6/site-packages/kafka/consumer/group.py", line 327, in __init__
    self._client = KafkaClient(metrics=self._metrics, **self.config)
  File "/opt/continuum/anaconda3/lib/python3.6/site-packages/kafka/client_async.py", line 225, in __init__
    self._bootstrap(collect_hosts(self.config['bootstrap_servers']))
  File "/opt/continuum/anaconda3/lib/python3.6/site-packages/kafka/client_async.py", line 259, in _bootstrap
    bootstrap.connect()
  File "/opt/continuum/anaconda3/lib/python3.6/site-packages/kafka/conn.py", line 384, in connect
    if self._try_authenticate():
  File "/opt/continuum/anaconda3/lib/python3.6/site-packages/kafka/conn.py", line 468, in _try_authenticate
    raise ex  # pylint: disable-msg=raising-bad-type
  File "/opt/continuum/anaconda3/lib/python3.6/site-packages/kafka/conn.py", line 567, in _try_authenticate_gssapi
    size = Int32.encode(len(msg))
TypeError: object of type 'NoneType' has no len()

For me this was fixed according to the following diff (changing function _try_authenticate_gssapi in conn.py):

563a564,566
>                 if client_ctx.complete:
>                     break
>

I don't know why but it looks like our implementation of Kerberos/gssapi needs another call to client_ctx.step(received_token) before the context is complete although it returns "None".

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions