Azure-Samples / Cognitive-Speech-STT-Android

Android SDK for the Microsoft Speech-to-Text API, part of Cognitive Services
https://www.microsoft.com/cognitive-services/en-us/speech-api
Other
102 stars 58 forks source link

Speech to Text stops working after 3 to 4 minutes in Android SDK Version 1.2.2 #69

Open harnish-padia opened 6 years ago

harnish-padia commented 6 years ago

Hello, We are facing issue using speech to text API, it works fine for around 4 minutes and suddenly it stops working. When checking in logcat(Android studio error logger) it shows errors as below. We are using it with subscription key

02-08 03:30:02.434 27572-4854/ I/NLPLAT: WebSocket closed unexpectedly, status: 0 02-08 03:30:02.844 27572-4865/ I/NLPLAT: Failed to 'hresult', HR=80004005, WebSocket connection failed ..... ..... ..... 02-08 03:30:11.552 27572-5155/ I/NLPLAT: Failed to 'hresult', HR=80004005, WebSocket connection failed 02-08 03:30:11.552 27572-5155/ I/NLPLAT: WebSocket closed unexpectedly, status: 0

02-08 03:29:38.057 27572-8428/ I/NLPLAT: WebSocket closed unexpectedly, status: 0 02-08 03:29:38.057 27572-8428/ I/NLPLAT: Initiating websocket connection. m_connection=0xbdf1d924 host=websockets.platform.bing.com port=443 02-08 03:29:38.060 27572-8430/ I/NLPLAT: WebSocket closed unexpectedly, status: 0 02-08 03:29:38.062 27572-8430/ I/NLPLAT: Initiating websocket connection. m_connection=0xbdf1d924 host=websockets.platform.bing.com port=443 02-08 03:29:38.065 27572-8432/ I/NLPLAT: WebSocket closed unexpectedly, status: 0

Any help would be highly appreciated.

roymasad commented 6 years ago

I am getting the same problem as well, did u manage to find a workaround/fix for it ?

roymasad commented 6 years ago

after 10 minutes, using a subscription key with the client java sdk and in longdictation speech recognition mode, i get the following error:

03-21 13:25:25.490 14967-15013/com.microsoft.CognitiveServicesExample I/NLPLAT: Waiting for connection/send completion. 03-21 13:25:25.577 14967-15013/com.microsoft.CognitiveServicesExample I/NLPLAT: Waiting for connection/send completion. 03-21 13:25:25.676 14967-15013/com.microsoft.CognitiveServicesExample I/NLPLAT: Waiting for connection/send completion. 03-21 13:25:25.797 14967-15013/com.microsoft.CognitiveServicesExample I/NLPLAT: Waiting for connection/send completion. 03-21 13:25:25.876 14967-15013/com.microsoft.CognitiveServicesExample I/NLPLAT: Waiting for connection/send completion. 03-21 13:25:25.983 14967-15013/com.microsoft.CognitiveServicesExample I/NLPLAT: Waiting for connection/send completion. 03-21 13:25:25.999 14967-15080/com.microsoft.CognitiveServicesExample I/NLPLAT: Upgrade request returned with HTTP status code: 101. 03-21 13:25:25.999 14967-15080/com.microsoft.CognitiveServicesExample I/NLPLAT: Web socket handshake completed 03-21 13:25:25.999 14967-15080/com.microsoft.CognitiveServicesExample I/NLPLAT: CU Client connected 03-21 13:25:26.000 14967-15080/com.microsoft.CognitiveServicesExample I/NLPLAT: Adding requestId: 'S' for '6' 03-21 13:25:26.000 14967-15080/com.microsoft.CognitiveServicesExample I/NLPLAT: Subscribing request [S] 03-21 13:25:26.000 14967-15080/com.microsoft.CognitiveServicesExample I/NLPLAT: Waiting for connection/send completion. 03-21 13:25:26.000 14967-15080/com.microsoft.CognitiveServicesExample I/NLPLAT: ConnectionStateChanged 03-21 13:25:26.219 14967-15081/com.microsoft.CognitiveServicesExample I/NLPLAT: Auth token status: 200 03-21 13:35:25.999 14967-15080/com.microsoft.CognitiveServicesExample I/NLPLAT: originating error 0x80004005 03-21 13:35:25.999 14967-15080/com.microsoft.CognitiveServicesExample I/NLPLAT: originating error 0x80004005 03-21 13:35:25.999 14967-15080/com.microsoft.CognitiveServicesExample I/NLPLAT: Failed to 'hresult', HR=80004005, WebSocket connection failed 03-21 13:35:25.999 14967-15080/com.microsoft.CognitiveServicesExample I/NLPLAT: No messages to retry, closing. 03-21 13:35:25.999 14967-15080/com.microsoft.CognitiveServicesExample I/NLPLAT: Closing web socket channel 03-21 13:35:26.000 14967-15080/com.microsoft.CognitiveServicesExample I/NLPLAT: CU Client connection dropped 03-21 13:35:26.000 14967-15080/com.microsoft.CognitiveServicesExample I/NLPLAT: ConnectionStateChanged 03-21 13:35:26.000 14967-15080/com.microsoft.CognitiveServicesExample I/NLPLAT: WebSocket closed unexpectedly, status: 0 03-21 13:35:26.000 14967-15080/com.microsoft.CognitiveServicesExample I/NLPLAT: Web socket channel already closed. 03-21 13:35:26.083 14967-15013/com.microsoft.CognitiveServicesExample I/NLPLAT: Initiating websocket connection. m_connection=0xd4e4430c host=websockets.platform.bing.com port=443 03-21 13:35:26.084 14967-15013/com.microsoft.CognitiveServicesExample I/NLPLAT: WSRequest 03-21 13:35:26.084 14967-15013/com.microsoft.CognitiveServicesExample I/NLPLAT: Authorization token hr 0 'S' 03-21 13:35:26.087 14967-15013/com.microsoft.CognitiveServicesExample I/NLPLAT: Refreshing token S 03-21 13:35:26.087 14967-15013/com.microsoft.CognitiveServicesExample I/NLPLAT: Waiting for connection/send completion. 03-21 13:35:26.176 14967-15013/com.microsoft.CognitiveServicesExample I/NLPLAT: Waiting for connection/send completion. 03-21 13:35:26.276 14967-15013/com.microsoft.CognitiveServicesExample I/NLPLAT: Waiting for connection/send completion. 03-21 13:35:26.395 14967-15013/com.microsoft.CognitiveServicesExample I/NLPLAT: Waiting for connection/send completion. 03-21 13:35:26.482 14967-15013/com.microsoft.CognitiveServicesExample I/NLPLAT: Waiting for connection/send completion. 03-21 13:35:26.583 14967-15013/com.microsoft.CognitiveServicesExample I/NLPLAT: Waiting for connection/send completion. 03-21 13:35:26.636 14967-15145/com.microsoft.CognitiveServicesExample I/NLPLAT: Upgrade request returned with HTTP status code: 101. 03-21 13:35:26.636 14967-15145/com.microsoft.CognitiveServicesExample I/NLPLAT: Web socket handshake completed 03-21 13:35:26.636 14967-15145/com.microsoft.CognitiveServicesExample I/NLPLAT: CU Client connected 03-21 13:35:26.637 14967-15145/com.microsoft.CognitiveServicesExample I/NLPLAT: Adding requestId: 'S' for '7' 03-21 13:35:26.637 14967-15145/com.microsoft.CognitiveServicesExample I/NLPLAT: Subscribing request [S] 03-21 13:35:26.637 14967-15145/com.microsoft.CognitiveServicesExample I/NLPLAT: Waiting for connection/send completion. 03-21 13:35:26.637 14967-15145/com.microsoft.CognitiveServicesExample I/NLPLAT: ConnectionStateChanged 03-21 13:35:26.728 14967-15146/com.microsoft.CognitiveServicesExample I/NLPLAT: Auth token status: 200

harnish-padia commented 6 years ago

@redphoenix2k no fixes found for this and no reply from Microsoft as well

EugeneSteshenko commented 6 years ago

Same problem:

after 10 minutes, using a subscription key with the client java sdk and in longdictation speech recognition mode, i get the following error

After 5-15 minutes (very often if the voice commands not use a long time) and with a paid key:

I/NLPLAT: originating error 0x80004005
I/NLPLAT: originating error 0x80004005
I/NLPLAT: Failed to 'hresult', HR=80004005, WebSocket connection failed
I/NLPLAT: No messages to retry, closing.
I/NLPLAT: Closing web socket channel
I/NLPLAT: CU Client connection dropped
I/NLPLAT: ConnectionStateChanged
I/NLPLAT: WebSocket closed unexpectedly, status: 0
I/NLPLAT: Web socket channel already closed.
I/NLPLAT: Initiating websocket connection. m_connection=0x7e9a3a64 host=websockets.platform.bing.com port=443
I/NLPLAT: WSRequest
I/NLPLAT: Authorization token hr 0 'S' 
I/NLPLAT: Refreshing token S
I/NLPLAT: Waiting for connection/send completion.
I/NLPLAT: Waiting for connection/send completion.
I/NLPLAT: Waiting for connection/send completion.
I/NLPLAT: Waiting for connection/send completion.
I/NLPLAT: Upgrade request returned with HTTP status code: 101.
I/NLPLAT: Web socket handshake completed
I/NLPLAT: CU Client connected
I/NLPLAT: Adding requestId: 'S' for 'a'
I/NLPLAT: Subscribing request [S]
I/NLPLAT: Waiting for connection/send completion.
I/NLPLAT: ConnectionStateChanged
I/NLPLAT: Auth token status: 200

Workaround for me - did set Timer with tic at few minutes:

class STTReinit extends TimerTask {
        @Override
        public void run() {
            if (micClient != null) {
                micClient.endMicAndRecognition();
                micClient.startMicAndRecognition();
            }
        }
    }