Azure-Samples / cognitive-services-speech-sdk

Sample code for the Microsoft Cognitive Services Speech SDK
MIT License
2.97k stars 1.86k forks source link

Connection failed (no connection to the remote host) WS_OPEN_ERROR_UNDERLYING_IO_OPEN_FAILED #1911

Closed tianyi14 closed 1 year ago

tianyi14 commented 1 year ago

Describe the bug Using the speech recognition text function, this error will be reported starting from April 7th

This is the error log

logspeech.txt

tianyi14 commented 1 year ago

Connection failed (no connection to the remote host). Internal error: 1. Error details: Failed with error: WS_OPEN_ERROR_UNDERLYING_IO_OPEN_FAILED wss://eastasia.stt.speech.microsoft.com/speech/recognition/interactive/cognitiveservices/v1?language=en-us X-ConnectionId: fbeac57c5c814e82bdbc9ca1d5336be5 SessionId: fbeac57c5c814e82bdbc9ca1d5336be5

tianyi14 commented 1 year ago

The client sdk used is 1.25.0 in Java language, running on Windows

rhurey commented 1 year ago

Thanks for adding the SDK log, the underlying error from it was: [912532]: 5075ms SPX_TRACE_ERROR: AZ_LOG_ERROR: socketio_win32.c:543 Socketio_Failure: Receiving data from endpoint: 10054.

Adn 10054 translates to: WSAECONNRESET10054 | Connection reset by peer. An existing connection was forcibly closed by the remote host. This normally results if the peer application on the remote host is suddenly stopped, the host is rebooted, the host or remote network interface is disabled, or the remote host uses a hard close (see setsockopt for more information on the SO_LINGER option on the remote socket). This error may also result if a connection was broken due to keep-alive activity detecting a failure while one or more operations are in progress. Operations that were in progress fail with WSAENETRESET. Subsequent operations fail with WSAECONNRESET.

So something between the client and the service reset the connection.

Can you connect using curl to download the list of supported languages? curl https://eastasia.stt.speech.microsoft.com/api/v1.0/languages/recognition

Does the connection always fail?

tianyi14 commented 1 year ago

curl https://eastasia.stt.speech.microsoft.com/api/v1.0/languages/recognition It can be connected.

tianyi14 commented 1 year ago

oh,no, I just tried it for the first time and it was okay. After 20 minutes of testing, I was told that the SSL connection failed 飞书20230411-105352

tianyi14 commented 1 year ago

Running on server, error 443, connection timeout

czkoko commented 1 year ago

https://learn.microsoft.com/zh-cn/azure/cognitive-services/speech-service/troubleshooting?tabs=powershell#connection-closed-or-timeout

tianyi14 commented 1 year ago

An error was reported while verifying the authorization token, as follows 1681198541054

czkoko commented 1 year ago

Windows 11 上存在一个已知问题,该问题可能会影响某些类型的安全套接字层 (SSL) 和传输层安全性 (TLS) 连接。 这些连接可能会出现握手失败。 对于开发人员,受影响的连接可能会在单个输入缓冲区中发送多个帧,然后发送大小小于 5 个字节的部分帧。 如果连接失败,你的应用将收到“USP 错误”、“连接关闭”、“服务超时”或“SEC_E_ILLEGAL_MESSAGE”等错误。 有一个适用于 Windows 11 的带外更新可以解决这些问题。 可以按照以下说明手动安装此更新: Windows 11 21H2 Windows 11 22H2

tianyi14 commented 1 year ago

But my computer is Win10. Do I need to update to 11?

tianyi14 commented 1 year ago

Just now I re executed the code and found that the speech recognition text is working. I didn't do anything. After restarting my computer, I ran it again and found that an error was reported again. Since then, I have never been successful again

tianyi14 commented 1 year ago

I am using the sample code here https://github.com/Azure-Samples/cognitive-services-speech-sdk/tree/master/scenarios/java/jre/console/captioning/

czkoko commented 1 year ago

After testing, this is a network failure in China, and I can't connect to the eastasia server too (will connect by vpn). Connect to https://eastus.stt.speech.microsoft.com/api/v1.0/languages/recognition for test, There should be no problem.

tianyi14 commented 1 year ago

But the audio synthesis function can be successfully called, and adding subtitles for voice to text is the only problem. Is the service accessed by the two different

tianyi14 commented 1 year ago

yes, Connect to https://eastus.stt.speech.microsoft.com/api/v1.0/languages/recognition,Sometimes it's possible, But even if the curl successfully responds, there are still issues with speech recognition execution

czkoko commented 1 year ago

Turn on the vpn for test, or create a new Subscription-Key for other regions.

rhurey commented 1 year ago

Speech Synthesis and Speech Recognition use different endpoints.

tianyi14 commented 1 year ago

If it is due to network issues, audio synthesis is possible, but audio recognition failed. Although it is two endpoints, I still feel a bit strange

tianyi14 commented 1 year ago

And even though I switched to Japan using VPN, I still reported the same error. I don't understand what caused it. This is the log of my VPN switching to Japan

logspeech2.txt

tianyi14 commented 1 year ago

My system is Win10, JDK 17, language Java, SDK is 1.25.0, and I have tried both 1.26.0 and 1.27.0, but the same problem,

rhurey commented 1 year ago

Thanks for the additional log, it's still the same error of a peer reset happening.

Unfortunately, it's typically difficult to determine which component is resetting connections unless it's killing a lot of them, and there's usually a good number of devices between data centers.

At this point the usual path is to take a WireShark trace, find the TCP RST packets that are coming back and compare their TTL numbers to a traceroute to the service and see if we can match up a device.

tianyi14 commented 1 year ago

I don't know if this information contains the data you need. Could you please take a look b51f3fa1d987f7ec6cd7b62f8f17999 fbe6295ea226fa8dbb42f3266c9e64a

tianyi14 commented 1 year ago

Today, I encountered a situation where I successfully called speech recognition for the first time, but when I called it again after a minute, it failed and seemed very unstable. Since then, there have been more and more failures, and I have never called it again successfully.Captioning () is a function that I encapsulate, but it is actually internally provided by Microsoft

2ebf77fe19b32655c25e5733b2975f5 b4da1ae1407cea8fd41f2203605e95b

czkoko commented 1 year ago

I can tell you clearly that the server you are using is in Hong Kong and has been blocked. https://www.racent.com/query-access-domain?q=eastasia.stt.speech.microsoft.com

rhurey commented 1 year ago

If 198.18.9.179 is the device resetting the connection it's a device in a private network address space. Perhaps a proxy between the client and the internet?

Have you tried using a China region?

leongj commented 1 year ago

I've just started with Text-to-Speech and the Express.js example works fine for me.

But the Python example gives me the error:

Error details: Connection failed (no connection to the remote host). Internal error: 1. Error details: Failed with error: WS_OPEN_ERROR_UNDERLYING_IO_OPEN_FAILED
wss://eastus.tts.speech.microsoft.com/cognitiveservices/websocket/v1
X-ConnectionId: 56a0d61ec89f4723931b6294e3a8fa19 USP state: Sending. Received audio size: 0 bytes.

This is on the exact same subscription_key and region as the JS demo, which is working fine.

Environment is:

As you can see I am using EastUS region. I am in Australia. UPDATE, just created a speech service in AustraliaEast and got the exact same results.

SDK Log attached log-speechsdk-2023_04_14-051938.log

UPDATE: I fixed this -- my WSL2 clock was out of sync with real time (and yeah this isn't fixed properly).

tianyi14 commented 1 year ago

We have solved this problem due to network proxies. Currently, there are issues with the Chinese network, and we have applied for a new secret key using Southeast Asia in the future

alex-pythonista commented 1 year ago

@tianyi14 Hello there, I am currently facing this issue with the centralindia region. How did you solve the problem?

Sirorezka commented 10 months ago

I had same problem when running 'speech sdk' through gunicorn. This error may be triggered when sdk can't find certificates path. What you should try to do:

  1. Check that you've installed OpenSSL v1.x as it is described setup_guide
  2. check that you have SSL_CERT_DIR env variable configured as it described in setup_guide
  3. if starting server-side process as another user (using sudo ... or sudo -u username) set env variable SSL_CERT_DIR directly in the code to be sure that this user have the env variable correctly configured.