Closed yjqiang closed 6 years ago
I'm not sure what changes you're suggesting here. Do you mean that websockets should do something specific to handle this situation?
Yes. As a user, I can't handle this even though I use 'try'. So I think maybe websockets should handle it.
But I'm still not sure whether it is the bug in my code or websockets or asyncio.
It's not obvious that there's a bug here. If your network connection is poor, then connections can break. In that case, an exception is raised, and the exception you showed seems clear to me.
Can websockets handle this exception? I think maybe you can just drop it and retry the connection. For me the exception is very uncomfortable.
OK, so that's a duplicate of #414.
No, it is strange that it just shows the message but "recv()" doesn't raise exceptions which means I can receive messages without reconnection.
It's really hard for me to say something meaningful with zero context about what code produces this traceback under what circumstances.
1."danmuji.connectServer" set up a connection
2."HeartbeatLoop" and "ReceiveMessageLoop" receive the msg and heartbeat
So, do you find where the problem is?
I'm not going to debug the 300 lines of code you linked to. If you can produce a minimal reproduction example that exhibits an issue in websockets, perhaps I will take a look.
Ok, I'll write a minimal program. Then I will tell you. By the way, I think you should reopen this issue.
I tested it last night, and I saw the msg again. And I wish the code is short enough for you to read.
Fatal read error on socket transport protocol: <asyncio.sslproto.SSLProtocol object at 0x111208ef0> transport: <_SelectorSocketTransport fd=12 read=polling write=<idle, bufsize=0>> Traceback (most recent call last): File "/var/containers/Bundle/Application/9F565D30-C54B-4210-902B-874D7A5AB814/Pythonista3.app/Frameworks/Py3Kit.framework/pylib/asyncio/selector_events.py", line 725, in _read_ready data = self._sock.recv(self.max_size) TimeoutError: [Errno 60] Operation timed out Error in data transfer Traceback (most recent call last): File "/private/var/mobile/Containers/Shared/AppGroup/DD7F02C7-CB2E-4501-8454-4160BFD1B7B2/Pythonista3/Documents/site-packages-3/websockets/protocol.py", line 530, in transfer_data msg = yield from self.read_message() File "/private/var/mobile/Containers/Shared/AppGroup/DD7F02C7-CB2E-4501-8454-4160BFD1B7B2/Pythonista3/Documents/site-packages-3/websockets/protocol.py", line 582, in read_message frame = yield from self.read_data_frame(max_size=self.max_size) File "/private/var/mobile/Containers/Shared/AppGroup/DD7F02C7-CB2E-4501-8454-4160BFD1B7B2/Pythonista3/Documents/site-packages-3/websockets/protocol.py", line 647, in read_data_frame frame = yield from self.read_frame(max_size) File "/private/var/mobile/Containers/Shared/AppGroup/DD7F02C7-CB2E-4501-8454-4160BFD1B7B2/Pythonista3/Documents/site-packages-3/websockets/protocol.py", line 712, in read_frame extensions=self.extensions, File "/private/var/mobile/Containers/Shared/AppGroup/DD7F02C7-CB2E-4501-8454-4160BFD1B7B2/Pythonista3/Documents/site-packages-3/websockets/framing.py", line 100, in read data = yield from reader(2) File "/var/containers/Bundle/Application/9F565D30-C54B-4210-902B-874D7A5AB814/Pythonista3.app/Frameworks/Py3Kit.framework/pylib/asyncio/streams.py", line 669, in readexactly yield from self._wait_for_data('readexactly') File "/var/containers/Bundle/Application/9F565D30-C54B-4210-902B-874D7A5AB814/Pythonista3.app/Frameworks/Py3Kit.framework/pylib/asyncio/streams.py", line 459, in _wait_for_data yield from self._waiter File "/var/containers/Bundle/Application/9F565D30-C54B-4210-902B-874D7A5AB814/Pythonista3.app/Frameworks/Py3Kit.framework/pylib/asyncio/futures.py", line 332, in iter yield self # This tells Task to wait for completion. File "/var/containers/Bundle/Application/9F565D30-C54B-4210-902B-874D7A5AB814/Pythonista3.app/Frameworks/Py3Kit.framework/pylib/asyncio/tasks.py", line 245, in _wakeup future.result() File "/var/containers/Bundle/Application/9F565D30-C54B-4210-902B-874D7A5AB814/Pythonista3.app/Frameworks/Py3Kit.framework/pylib/asyncio/futures.py", line 245, in result raise self._exception File "/var/containers/Bundle/Application/9F565D30-C54B-4210-902B-874D7A5AB814/Pythonista3.app/Frameworks/Py3Kit.framework/pylib/asyncio/selector_events.py", line 725, in _read_ready data = self._sock.recv(self.max_size) TimeoutError: [Errno 60] Operation timed out
Is there anything else I can do for you? Maybe my code and the message are not clearly enough, but I hope it can help you.
It occurred frequently recently, it is very confusing.
?
Keep showing the msg...
I'm sorry but I really can't help with what you've provided.
In the context of a bug report, a "minimal program" is something about as large as https://github.com/aaugustin/websockets/blob/master/example/client.py.
I suppose I could install go, compile the 638 lines of Go and run a server, connect a client with the 379 lines of Python, and see that stack trace... and I'd be left with "well I guess Go server times out somewhere".
Unfortunately I don't have the motivation to do this.
Sorry to bother u but it looks like it is a bug on Pythonista(ios). I'm so sorry about this.
No problem. Feel free to open a new issue if you end up suspecting something in websockets.
I’m so sorry. Sorry I just found I sent the wrong test file. But I think it’s unnecessary to resend since it’s not a bug in websockets. I wrote it just to apologize. Sorry.
Fatal read error on socket transport protocol: <asyncio.sslproto.SSLProtocol object at 0x1177ce940> transport: <_SelectorSocketTransport fd=47 read=polling write=<idle, bufsize=0>> Traceback (most recent call last): File "/var/containers/Bundle/Application/9F565D30-C54B-4210-902B-874D7A5AB814/Pythonista3.app/Frameworks/Py3Kit.framework/pylib/asyncio/selector_events.py", line 725, in _read_ready data = self._sock.recv(self.max_size) TimeoutError: [Errno 60] Operation timed out