Skip to content

Conversation

@dolfies
Copy link
Contributor

@dolfies dolfies commented Jun 23, 2025

I've run into a number of issues when implementing websockets in an actual async environment (i.e. constantly calling recv() while connect/close logic is handled concurrently). A lot of these issues have been fixed by #570 (and seemingly by curl updates in general), but the below remain.

  • the aselect() call in recv() deadlocks if the socket is closed while waiting, as it waits forever (or until timeout) for a closed websocket to be open again
  • self.closed races and curl_easy_getinfo, curl_ws_recv, and curl_ws_send are called with null curl handles (as they were closed between the check happening and the function being called), throwing some fun TypeErrors
  • the asyncio selector thread would raise more fun OSErrors relating to the socket descriptors being closed

There might be more, but this is all I could find for now.

I will update this PR to fix any similar issues that arise with the merging of #570 (therefore this PR depends on that PR)

if isinstance(payload, str):
payload = payload.encode()

# TODO: Why does concurrently sending fail
Copy link
Owner

Choose a reason for hiding this comment

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

Was this TODO resolved somehow?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah, it's because the curl websockets implementation is abysmal

@dolfies
Copy link
Contributor Author

dolfies commented Nov 2, 2025

Superseded by #650

@dolfies dolfies closed this Nov 2, 2025
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.

2 participants