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

client_async: Allow throwing an exception upon socket error during wakeup #2371

Open
wants to merge 12 commits into
base: master
Choose a base branch
from

Conversation

shimon-armis
Copy link

@shimon-armis shimon-armis commented Jun 26, 2023

Motivation

When wakeup() is called, we sometime notice that we get an endless prints:
"Unable to send to wakeup socket!".
Those prints are spamming the logs.

Description

This commit aims to address it by allowing restating the application via an intentional exception raise.
This behavior is configurable and its default is backward compatible.

We see this issue with kafka-python 2.0.2


This change is Reviewable

@shimon-armis
Copy link
Author

@dpkp Can u please review this PR?

wakeup

When wakeup() is called, we sometime notice that we get
an endless prints:
"Unable to send to wakeup socket!".

Those prints are spamming the logs.
This commit aims to address it by allowing restating the
application via an intentional exception raise.
This behavior is configurable and its default is backward compatible.

Signed-off-by: shimon-armis <shimon.turjeman@armis.com>
@shimon-armis shimon-armis force-pushed the shimon.enable_throwing_an_exception_upon_socket_error_during_wakeup branch from ce0c863 to ef4721c Compare June 26, 2023 17:47
@wbarnha
Copy link
Collaborator

wbarnha commented Aug 3, 2023

@shimon-armis do you have a traceback of the logs in question, and some sample code?

wbarnha and others added 10 commits March 7, 2024 10:31
…terations for Kafka 0.8.2 and Python 3.12 (dpkp#159)

* skip failing tests for PyPy since they work locally

* Reconfigure tests for PyPy and 3.12

* Skip partitioner tests in test_partitioner.py if 3.12 and 0.8.2

* Update test_partitioner.py

* Update test_producer.py

* Timeout tests after ten minutes

* Set 0.8.2.2 to be experimental from hereon

* Formally support PyPy 3.9
* Test Kafka 0.8.2.2 using Python 3.11 in the meantime

* Override PYTHON_LATEST conditionally in python-package.yml

* Update python-package.yml

* add python annotation to kafka version test matrix

* Update python-package.yml

* try python 3.10
* Remove support for EOL'ed versions of Python

* Update setup.py
Too many MRs to review... so little time.
After stop/start kafka service, kafka-python may use 100% CPU caused by
busy-retry while the socket was closed. This fix the issue by unregister
the socket if the fd is negative.

Co-authored-by: Orange Kao <orange@aiven.io>
Co-authored-by: Ryar Nyah <ryarnyah@gmail.com>
@shimon-armis
Copy link
Author

@shimon-armis do you have a traceback of the logs in question, and some sample code?

Hey @wbarnha, It's been a while :) but here are some snippet I found in my slack's DM.
Note, It isn't a complete traceback.
W0221 08:13:16.082472 kafka.client 1-140694973044480 /home/runner/pipeline.runfiles/pip_kafka_python/site-packages/kafka/client_async.py:331] Node 11 connection failed -- refreshing metadata W0221 08:13:16.083114 kafka.client 1-140694973044480 /home/runner/pipeline.runfiles/pip_kafka_python/site-packages/kafka/client_async.py:331] Node 12 connection failed -- refreshing metadata W0221 08:13:16.084225 kafka.client 1-140694973044480 /home/runner/pipeline.runfiles/pip_kafka_python/site-packages/kafka/client_async.py:331] Node 13 connection failed -- refreshing metadata W0221 08:13:16.224422 kafka.client 1-140694981437184 /home/runner/pipeline.runfiles/pip_kafka_python/site-packages/kafka/client_async.py:331] Node 19 connection failed -- refreshing metadata W0221 08:13:16.254804 kafka.client 1-140694589003520 /home/runner/pipeline.runfiles/pip_kafka_python/site-packages/kafka/client_async.py:331] Node 20 connection failed -- refreshing metadata W0221 08:13:16.324988 kafka.client 1-140694981437184 /home/runner/pipeline.runfiles/pip_kafka_python/site-packages/kafka/client_async.py:937] Unable to send to wakeup socket! W0221 08:13:16.425574 kafka.client 1-140694981437184 /home/runner/pipeline.runfiles/pip_kafka_python/site-packages/kafka/client_async.py:937] Unable to send to wakeup socket! W0221 08:13:16.526113 kafka.client 1-140694981437184 /home/runner/pipeline.runfiles/pip_kafka_python/site-packages/kafka/client_async.py:937] Unable to send to wakeup socket! W0221 08:13:16.626606 kafka.client 1-140694981437184 /home/runner/pipeline.runfiles/pip_kafka_python/site-packages/kafka/client_async.py:937] Unable to send to wakeup socket! W0221 08:13:16.727129 kafka.client 1-140694981437184 /home/runner/pipeline.runfiles/pip_kafka_python/site-packages/kafka/client_async.py:937] Unable to send to wakeup socket! W0221 08:13:16.827740 kafka.client 1-140694981437184 /home/runner/pipeline.runfiles/pip_kafka_python/site-packages/kafka/client_async.py:937] Unable to send to wakeup socket!

@shimon-armis
Copy link
Author

@wbarnha Note that the suggested change is an acceptable practice, under the circumstances.
I probably missed your previous comment but will happy if we can get this done quickly 🙏

@wbarnha
Copy link
Collaborator

wbarnha commented Mar 10, 2024

I'm resuming work on this in wbarnha#134!

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

Successfully merging this pull request may close these issues.

None yet

2 participants