question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

KafkaProducer fails when many sockets are opened

See original GitHub issue

When using KafkaProducer in an environment with over 1024 open sockets we get the following issue:

File "/srv/.../lib/python2.7/site-packages/kafka/producer/kafka.py", line 248, in __init__
self.config['api_version'] = client.check_version()
File "/srv/.../lib/python2.7/site-packages/kafka/client_async.py", line 639, in check_version
self.poll(future=f)
File "/srv/.../lib/python2.7/site-packages/kafka/client_async.py", line 367, in poll
responses.extend(self._poll(timeout, sleep=sleep))
File "/srv/.../lib/python2.7/site-packages/kafka/client_async.py", line 402, in _poll
ready, _, _ = select.select(fds, [], [], timeout)
ValueError: filedescriptor out of range in select()

AFAIK this is because the select() call is limited to FD_SETSIZE being 1024 on Linux.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:10 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
dpkpcommented, Mar 29, 2016

thanks for bug report! we’ll need to get more sophisticated here. one semi-related improvement is to add support for closing idle sockets (Issue #548). the real fix here may be to check for select alternatives (epoll / poll / etc).

0reactions
dpkpcommented, Apr 9, 2016

I put up PR #640 to migrate to the selectors module and remove the explicit use of select. Please let me know if you have comments or have a moment to test whether this fixes your issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot run Kafka Producer due to socket.error - Stack Overflow
I have a local docker-machine and I am trying to run a Kafka producer written in python. However, it gives a socket.error: [Errno...
Read more >
Kafka Producer Configurations for Confluent Platform
If the connection is not built before the timeout elapses, clients will close the socket channel. Type: long. Default: 10000 (10 seconds). Valid...
Read more >
KafkaProducer — kafka-python 2.0.2-dev documentation
If the request fails, the producer can automatically retry, ... The message will immediately be added to the socket buffer and considered sent....
Read more >
Critical Kafka Producer Config Parameters Simplified - Learn
But before getting started with Kafka Producer Configurations, ... will be immediately added to the socket buffer and considered sent.
Read more >
How to Fix Apache Kafka Error, "NoBrokersAvailable" - Pandio
The no brokers available error is one of the most common standard errors in Apache Kafka. It usually occurs when you try to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found