You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When attempting to send notifications with timeout, first timeout causes a deadlock to the sender making future request wait for a lock endlessly.
Example:
My code calls send_notifications with timeout: response = await asyncio.wait_for(self.client.send_notification(request), timeout)
After multiple successful sends I got a timeout with:
Traceback (most recent call last):
File \"/usr/local/lib/python3.10/site-packages/aioapns/client.py\", line 58, in send_notification
response = await self.pool.send_notification(request)
File \"/usr/local/lib/python3.10/site-packages/aioapns/connection.py\", line 387, in send_notification
connection = await self.acquire()
File \"/usr/local/lib/python3.10/site-packages/aioapns/connection.py\", line 358, in acquire
connection = await self.create_connection()
File \"/usr/local/lib/python3.10/site-packages/aioapns/connection.py\", line 501, in create_connection
_, protocol = await self.loop.create_connection(
File \"/usr/local/lib/python3.10/asyncio/base_events.py\", line 1089, in create_connection
transport, protocol = await self._create_connection_transport(
File \"/usr/local/lib/python3.10/asyncio/base_events.py\", line 1119, in _create_connection_transport
await waiter
asyncio.exceptions.CancelledError
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File \"/usr/local/lib/python3.10/asyncio/tasks.py\", line 456, in wait_for
return fut.result()
asyncio.exceptions.CancelledError
but since it exits without releasing the lock it acquires - all future requests gets stuck waiting for the same lock:
Traceback (most recent call last):
File \"/usr/local/lib/python3.10/site-packages/aioapns/client.py\", line 58, in send_notification
response = await self.pool.send_notification(request)
File \"/usr/local/lib/python3.10/site-packages/aioapns/connection.py\", line 387, in send_notification
connection = await self.acquire()
File \"/usr/local/lib/python3.10/site-packages/aioapns/connection.py\", line 351, in acquire
await self._lock.acquire()
File \"/usr/local/lib/python3.10/asyncio/locks.py\", line 114, in acquire
await fut
asyncio.exceptions.CancelledError
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File \"/usr/local/lib/python3.10/asyncio/tasks.py\", line 456, in wait_for
return fut.result()
asyncio.exceptions.CancelledError
Was there a reason you chose to not use a context manager with this lock? If not is it possible to change it to use one to avoid this situation?
The text was updated successfully, but these errors were encountered:
alexmv
added a commit
to alexmv/aioapns
that referenced
this issue
Aug 22, 2023
When attempting to send notifications with timeout, first timeout causes a deadlock to the sender making future request wait for a lock endlessly.
Example:
My code calls send_notifications with timeout:
response = await asyncio.wait_for(self.client.send_notification(request), timeout)
After multiple successful sends I got a timeout with:
but since it exits without releasing the lock it acquires - all future requests gets stuck waiting for the same lock:
Was there a reason you chose to not use a context manager with this lock? If not is it possible to change it to use one to avoid this situation?
The text was updated successfully, but these errors were encountered: