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

[Pyamqp] Revert back to websocket-client #26787

Closed

Conversation

kashifkhan
Copy link
Member

aiohttp websocket has 2 bugs when a connection is abruptly cut:

  • websocket send does not throw an exception -> issue -> known since 2017

  • websocket receive gets stuck if network is suddenly disconnected -> PR -> unmerged since July 2021

Reverting back to websocket-client in async as that is what most are using. There is another async websocket client but it doesnt support proxies.

@kashifkhan
Copy link
Member Author

/azp run python - eventhub - tests

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@@ -149,6 +149,36 @@ async def send_frame(self, channel, frame, **kwargs):
await self.write(data)
# _LOGGER.info("OCH%d -> %r", channel, frame)

class AsyncTransport(
Copy link
Member

Choose a reason for hiding this comment

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

can we copy changes to SB pyamqp as well?

Copy link
Member Author

Choose a reason for hiding this comment

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

yes these changes will have to go back there too

Copy link
Member

Choose a reason for hiding this comment

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

sorry, I meant can you copy them over in this PR? 🙂
or do we want to do that later?

Copy link
Member Author

Choose a reason for hiding this comment

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

lol my reply wasnt clear, Ill do it in this PR itself :)


async def _read(self, n, buffer=None, **kwargs): # pylint: disable=unused-argument
async def _read(self, n, buffer=None, **kwargs): # pylint: disable=unused-arguments
Copy link
Member

Choose a reason for hiding this comment

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

might be a typo and need to be

Suggested change
async def _read(self, n, buffer=None, **kwargs): # pylint: disable=unused-arguments
async def _read(self, n, buffer=None, **kwargs): # pylint: disable=unused-argument

Copy link
Member

Choose a reason for hiding this comment

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

not sure if this will be a lot of work, but would you be able to compare with the sync transport/websocket to see if there were changes that need to be copied over here? I think I may have added some mypy/pylint things?

Copy link
Member Author

Choose a reason for hiding this comment

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

not a lot of work, I just brought in the old WebSocketTransportAsync and the current portions untouched. Any re-shuffling will keep all the pylint/mypy work. Will take a look at the WebSocketTransportAsync though

@azure-sdk
Copy link
Collaborator

API change check

APIView has identified API level changes in this PR and created following API reviews.

azure-eventhub

@kashifkhan
Copy link
Member Author

/azp run python - eventhub - tests

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@kashifkhan
Copy link
Member Author

/azp run python - eventhub - tests

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@kashifkhan
Copy link
Member Author

/azp run python - eventhub - tests

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@kashifkhan
Copy link
Member Author

/azp run python - eventhub - tests

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@kashifkhan
Copy link
Member Author

/azp run python - eventhub - tests

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@kashifkhan
Copy link
Member Author

Due to issues with running websocket-client in async mode, we decided to stay with aiohttp for async. We were able to use heartbeat from aiohttp and timeouts to mitigate the bugs.

@kashifkhan kashifkhan closed this Oct 25, 2022
@gil-cohen
Copy link

@kashifkhan im having the same issue, can you elaborate on what you did with aiohttp, which timeouts did you use?

@kashifkhan
Copy link
Member Author

@kashifkhan im having the same issue, can you elaborate on what you did with aiohttp, which timeouts did you use?

@gil-cohen I passed in heartbeat parameter in ws_connect with a value of 10 seconds. That was enough time for the library to determine that the underlying connection has been lost.

Additionally you can take a look at these 2 PRs where you can see the changes and some of the exceptions that I am now addressing

#26856
https://github.com/Azure/azure-sdk-for-python/pull/27006/files

@kashifkhan kashifkhan deleted the eh_py_rev_ws branch November 29, 2022 20:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants