Closed altherat closed 2 years ago
This looks like https://bugs.python.org/issue12343 . Try replacing the data = self.client.recv(16384)
with
try:
data = self.client.recv(16384)
except ssl.SSLWantReadError:
return
This looks like https://bugs.python.org/issue12343 . Try replacing the
data = self.client.recv(16384)
withtry: data = self.client.recv(16384) except ssl.SSLWantReadError: return
If its working would you like to put in a pull request?
Unfortunately I have not been able to test any of this as I have not run into this problem myself. There also seems to be very little documentation about this issue, and one of the few comments I've seen says select() is not going to fire when the data does arrive, so I'm hesitant to commit code I can't verify works. I have some ideas on a test setup to try and reproduce this but have not found the time to set it up.
This project has been really helpful. Ran into a similar problem as in this thread. The SSL websocket was closing when a large amount of data was sent. I found a solution. I got rid of the else statement at line 341. Then the while loop sending data retries until it is successful rather than closing the socket.
I don't like blindly ignoring all errors as on an unclean close the socket is going to hang and stick around forever and block all other clients while it does it. What is the exact exception thrown? Adding it to the list of try-again exceptions would be better.
I'm using OkHttpClient on Android to connect to my websocket server. When my app establishes a connection, I send a message. Shorter messages don't have an issue, but for longer messages I'm getting an exception. The message I'm testing with is 14819 characters long in JSON format, but I've tested some smaller messages and the exception starts appearing when it's around 4315 characters long. The culprit is this line.
Here's the stack trace:
I don't know the protocol well so it's hard for me to tell whether it's the fault of this library or OkHttpClient or maybe I'm just doing something wrong. The only thing I've tried is increasing the
16384
to a higher number but it didn't help.