-
Notifications
You must be signed in to change notification settings - Fork 194
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
If we don't want timeouts we must set the socket's timeout to None #281
base: main
Are you sure you want to change the base?
Conversation
…t set the socket's timeout to None See https://docs.python.org/3/library/socket.html#socket.socket.settimeout. This commit was triggered by celery/celery#4876 (comment). It could fix the issue as well.
With this change, the integration tests hang on Travis. @matusvalo Any idea why? |
@thedrow, see my comments in the patch. The problem is that when you are using publisher confirm, the publisher checks before publishing if broker sent a message to him. This relies on |
So what should we do to fix this issue exactly? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What would change on PR is:
- remove internal interfaces changes which breaks current code -
having_timeout()
method. - Fix all timeouts in public interfaces...
Lines 1686 to 1688 in b36bf88
def _basic_publish(self, msg, exchange='', routing_key='', | |
mandatory=False, immediate=False, timeout=None, | |
argsig='Bssbb'): |
Line 507 in b36bf88
def blocking_read(self, timeout=None): |
In this way it should work. Maybe we can add also integration tests for each timeout input?
@@ -91,7 +92,7 @@ def connect(self): | |||
|
|||
@contextmanager | |||
def having_timeout(self, timeout): | |||
if timeout is None: | |||
if timeout is None or timeout == 0: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line of code breaks the following:
Lines 1764 to 1769 in b36bf88
if capabilities.get('connection.blocked', False): | |
try: | |
# Check if an event was sent, such as the out of memory message | |
self.connection.drain_events(timeout=0) | |
except socket.timeout: | |
pass |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The def having_timeout()
method should be not changed because:
- it is internal API
- we are using it as mentioned above.
See https://docs.python.org/3/library/socket.html#socket.socket.settimeout.
This commit was triggered by celery/celery#4876 (comment).
It could fix the issue as well.