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

Check whether on_data future is done before setting result/exception #1031

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

Conversation

rohitsanj
Copy link

@rohitsanj rohitsanj commented May 8, 2023

This should fix the following error seen in one of Noteable's production servers recently:

Fatal error: protocol.data_received() call failed.
protocol: <asyncpg.connect_utils.TLSUpgradeProto object at 0x7f7711fd9e70>
transport: <_SelectorSocketTransport fd=653 read=polling write=<idle, bufsize=0>>

Traceback (most recent call last):
  File "/usr/local/lib/python3.10/asyncio/selector_events.py", line 876, in _read_ready__data_received
    self._protocol.data_received(data)
  File "/srv/noteable/.venv/lib/python3.10/site-packages/asyncpg/connect_utils.py", line 665, in data_received
    self.on_data.set_result(True)
asyncio.exceptions.InvalidStateError: invalid state

@rohitsanj rohitsanj closed this May 8, 2023
@rohitsanj rohitsanj deleted the check-if-future-done-on-data-received branch May 8, 2023 23:23
@rohitsanj rohitsanj restored the check-if-future-done-on-data-received branch May 8, 2023 23:23
@rohitsanj rohitsanj reopened this May 8, 2023
Copy link
Member

@elprans elprans left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The bug is likely elsewhere. Ignoring data from server like this doesn't seem like the right fix.

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