alphacep / vosk-server

WebSocket, gRPC and WebRTC speech recognition server based on Vosk and Kaldi libraries
Apache License 2.0
896 stars 243 forks source link

Errors in sending request to sever in local network through Cell phone traffic in outside network #127

Closed ben-8878 closed 2 years ago

ben-8878 commented 3 years ago

it is normal when send request through wifi, but the request will be canceled through Cell phone traffic.(1-2seconds request is normal through Cell phone traffic, more than 2 seconds is abnormal )

sever catch follows errors:

Error in connection handler
Traceback (most recent call last):
  File "/home/zyb/miniconda3/lib/python3.8/site-packages/websockets/legacy/protocol.py", line 750, in transfer_data
    message = await self.read_message()
  File "/home/zyb/miniconda3/lib/python3.8/site-packages/websockets/legacy/protocol.py", line 819, in read_message
    frame = await self.read_data_frame(max_size=self.max_size)
  File "/home/zyb/miniconda3/lib/python3.8/site-packages/websockets/legacy/protocol.py", line 895, in read_data_frame
    frame = await self.read_frame(max_size)
  File "/home/zyb/miniconda3/lib/python3.8/site-packages/websockets/legacy/protocol.py", line 971, in read_frame
    frame = await Frame.read(
  File "/home/zyb/miniconda3/lib/python3.8/site-packages/websockets/legacy/framing.py", line 85, in read
    data = await reader(length)
  File "/home/zyb/miniconda3/lib/python3.8/asyncio/streams.py", line 723, in readexactly
    await self._wait_for_data('readexactly')
  File "/home/zyb/miniconda3/lib/python3.8/asyncio/streams.py", line 517, in _wait_for_data
    await self._waiter
asyncio.exceptions.CancelledError

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/zyb/miniconda3/lib/python3.8/site-packages/websockets/legacy/server.py", line 293, in handler
    await self.ws_handler(self, path)
  File "asr_server4_short_connect.py", line 64, in recognize
    message = await websocket.recv()
  File "/home/zyb/miniconda3/lib/python3.8/site-packages/websockets/legacy/protocol.py", line 421, in recv
    await self.ensure_open()
  File "/home/zyb/miniconda3/lib/python3.8/site-packages/websockets/legacy/protocol.py", line 735, in ensure_open
    raise self.connection_closed_exc()
websockets.exceptions.ConnectionClosedError: code = 1006 (connection closed abnormally [internal]), no reason
Error in connection handler
Traceback (most recent call last):
  File "/home/zyb/miniconda3/lib/python3.8/site-packages/websockets/legacy/protocol.py", line 750, in transfer_data
    message = await self.read_message()
  File "/home/zyb/miniconda3/lib/python3.8/site-packages/websockets/legacy/protocol.py", line 819, in read_message
    frame = await self.read_data_frame(max_size=self.max_size)
  File "/home/zyb/miniconda3/lib/python3.8/site-packages/websockets/legacy/protocol.py", line 895, in read_data_frame
    frame = await self.read_frame(max_size)
  File "/home/zyb/miniconda3/lib/python3.8/site-packages/websockets/legacy/protocol.py", line 971, in read_frame
    frame = await Frame.read(
  File "/home/zyb/miniconda3/lib/python3.8/site-packages/websockets/legacy/framing.py", line 85, in read
    data = await reader(length)
  File "/home/zyb/miniconda3/lib/python3.8/asyncio/streams.py", line 721, in readexactly
    raise exceptions.IncompleteReadError(incomplete, n)
asyncio.exceptions.IncompleteReadError: 49138 bytes read on a total of 410180 expected bytes

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/zyb/miniconda3/lib/python3.8/site-packages/websockets/legacy/server.py", line 293, in handler
    await self.ws_handler(self, path)
  File "asr_server4_short_connect.py", line 64, in recognize
    message = await websocket.recv()
  File "/home/zyb/miniconda3/lib/python3.8/site-packages/websockets/legacy/protocol.py", line 421, in recv
    await self.ensure_open()
  File "/home/zyb/miniconda3/lib/python3.8/site-packages/websockets/legacy/protocol.py", line 726, in ensure_open
    raise self.connection_closed_exc()
websockets.exceptions.ConnectionClosedError: code = 1006 (connection closed abnormally [internal]), no reason

errors 2:

websockets.exceptions.ConnectionClosedError: code = 1006 (connection closed abnormally [internal]), no reason
<class 'bytes'>
<class 'bytes'>
<class 'bytes'>
<class 'bytes'>
Error in connection handler
Traceback (most recent call last):
  File "/home/zyb/miniconda3/lib/python3.8/site-packages/websockets/legacy/protocol.py", line 750, in transfer_data
    message = await self.read_message()
  File "/home/zyb/miniconda3/lib/python3.8/site-packages/websockets/legacy/protocol.py", line 819, in read_message
    frame = await self.read_data_frame(max_size=self.max_size)
  File "/home/zyb/miniconda3/lib/python3.8/site-packages/websockets/legacy/protocol.py", line 895, in read_data_frame
    frame = await self.read_frame(max_size)
  File "/home/zyb/miniconda3/lib/python3.8/site-packages/websockets/legacy/protocol.py", line 971, in read_frame
    frame = await Frame.read(
  File "/home/zyb/miniconda3/lib/python3.8/site-packages/websockets/legacy/framing.py", line 55, in read
    data = await reader(2)
  File "/home/zyb/miniconda3/lib/python3.8/asyncio/streams.py", line 721, in readexactly
    raise exceptions.IncompleteReadError(incomplete, n)
asyncio.exceptions.IncompleteReadError: 0 bytes read on a total of 2 expected bytes

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/zyb/miniconda3/lib/python3.8/site-packages/websockets/legacy/server.py", line 293, in handler
    await self.ws_handler(self, path)
  File "asr_server4_short_connect.py", line 64, in recognize
    message = await websocket.recv()
  File "/home/zyb/miniconda3/lib/python3.8/site-packages/websockets/legacy/protocol.py", line 421, in recv
    await self.ensure_open()
  File "/home/zyb/miniconda3/lib/python3.8/site-packages/websockets/legacy/protocol.py", line 726, in ensure_open
    raise self.connection_closed_exc()
websockets.exceptions.ConnectionClosedError: code = 1006 (connection closed abnormally [internal]), no reason

client catch follows errors:

Traceback (most recent call last):
  File "/Users/zhangyunbin/miniconda3/lib/python3.8/site-packages/websockets/legacy/protocol.py", line 750, in transfer_data
    message = await self.read_message()
  File "/Users/zhangyunbin/miniconda3/lib/python3.8/site-packages/websockets/legacy/protocol.py", line 819, in read_message
    frame = await self.read_data_frame(max_size=self.max_size)
  File "/Users/zhangyunbin/miniconda3/lib/python3.8/site-packages/websockets/legacy/protocol.py", line 895, in read_data_frame
    frame = await self.read_frame(max_size)
  File "/Users/zhangyunbin/miniconda3/lib/python3.8/site-packages/websockets/legacy/protocol.py", line 971, in read_frame
    frame = await Frame.read(
  File "/Users/zhangyunbin/miniconda3/lib/python3.8/site-packages/websockets/legacy/framing.py", line 55, in read
    data = await reader(2)
  File "/Users/zhangyunbin/miniconda3/lib/python3.8/asyncio/streams.py", line 723, in readexactly
    await self._wait_for_data('readexactly')
  File "/Users/zhangyunbin/miniconda3/lib/python3.8/asyncio/streams.py", line 517, in _wait_for_data
    await self._waiter
  File "/Users/zhangyunbin/miniconda3/lib/python3.8/asyncio/selector_events.py", line 846, in _read_ready__data_received
    data = self._sock.recv(self.max_size)
TimeoutError: [Errno 60] Operation timed out

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/Users/zhangyunbin/Downloads/vtt.py", line 28, in <module>
    asyncio.get_event_loop().run_until_complete(request_api('wss://asr-edc.gwm.cn'))
  File "/Users/zhangyunbin/miniconda3/lib/python3.8/asyncio/base_events.py", line 616, in run_until_complete
    return future.result()
  File "/Users/zhangyunbin/Downloads/vtt.py", line 21, in request_api
    res = await websocket.recv()
  File "/Users/zhangyunbin/miniconda3/lib/python3.8/site-packages/websockets/legacy/protocol.py", line 421, in recv
    await self.ensure_open()
  File "/Users/zhangyunbin/miniconda3/lib/python3.8/site-packages/websockets/legacy/protocol.py", line 726, in ensure_open
    raise self.connection_closed_exc()
websockets.exceptions.ConnectionClosedError: code = 1006 (connection closed abnormally [internal]), no reason
nshmyrev commented 3 years ago

Those are more or less reasonable? If connection fails, server reports. What do you want to see otherwise?

ben-8878 commented 3 years ago

I don't understand it(my english maybe pool)