Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4791 pages
AI and LLM integration

Azure Speech cannot open its WebSocket on Linux

Your error

Connection failed (no connection to the remote host). Internal error: 1. Error details: Failed with error: WS_OPEN_ERROR_UNDERLYING_IO_OPEN_FAILED3 more lines it can show

Fix it fast

Most common cause, 1 of 3

An SDK older than 1.48.2 matches the certificate to the wrong CRL

Move to 1.48.2 or newer; 1.53.1 is current.

Fix
go get github.com/Microsoft/cognitive-services-speech-sdk-go@v1.53.1
wget -O SpeechSDK-Linux.tar.gz https://aka.ms/csspeech/linuxbinary
tar --strip 1 -xzf SpeechSDK-Linux.tar.gz -C "$SPEECHSDK_ROOT"

// stopgap only, in Go code:
speechConfig.SetPropertyByString("OPENSSL_DISABLE_CRL_CHECK", "true")
Did this fix it?
Full steps for this cause: check, fix, verify

Short answer

WS_OPEN_ERROR_UNDERLYING_IO_OPEN_FAILED means the Speech SDK could not finish the TLS handshake for its WebSocket to Azure Speech. On Linux and Android, SDK releases before 1.48.2 can reject valid certificates since Azure moved to partitioned CRLs (the log shows Error 44). Upgrade the binding and the native library to 1.53.1, then check CA certificates and outbound rules.

  • Applies to Azure Speech SDK 1.53.1 (Go, Python, C#, Java bindings), Speech SDK for Go v1.53.1 with cgo, Linux and Android hosts using OpenSSL 1.x or 3.x
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Which cause do you have?

The cancel message alone never says why the socket failed. Turn on the SDK log file before you create the synthesizer, run once, and search the log. Error 44 points to cause 1, certificate verify failed without Error 44 to cause 2, and socket errors such as a poll failure with no TLS line to cause 3.

Run this first
// Go: add before speech.NewSpeechSynthesizerFromConfig(...)
speechConfig.SetProperty(common.SpeechLogFilename, "/tmp/speech-sdk.log")

# then, in a shell
grep -nE "Error 44|certificate verify failed|WS_OPEN" /tmp/speech-sdk.log

Then find the line you see in this list and open its fix:

  1. 1An SDK older than 1.48.2 matches the certificate to the wrong CRLThe log has Error 44 was unexpected (X509_V_ERR_DIFFERENT_CRL_SCOPE), often in an app that had been working for weeks
  2. 2OpenSSL on the host has no trusted root certificates where it lookscertificate verify failed appears without Error 44, and the certs folder under OPENSSLDIR is empty or holds a single bundle file
  3. 3A firewall or proxy blocks the Speech host or the CRL downloadThe same build works on a laptop but fails inside a locked-down network, and a plain curl to the resource hangs or is reset

What does the error look like?

  • Connection failed (no connection to the remote host). Internal error: 1. Error details: Failed with error: WS_OPEN_ERROR_UNDERLYING_IO_OPEN_FAILED
  • web_socket.cpp:930 WS open operation failed with result=1(WS_OPEN_ERROR_UNDERLYING_IO_OPEN_FAILED)
  • AZ_LOG_ERROR: tlsio_openssl.c:1655 Error 44 was unexpected
  • AZ_LOG_ERROR: tlsio_openssl.c:691 error:0A000086:SSL routines::certificate verify failed

Cause 1 of 3

An SDK older than 1.48.2 matches the certificate to the wrong CRL

You seeThe log has Error 44 was unexpected (X509_V_ERR_DIFFERENT_CRL_SCOPE), often in an app that had been working for weeks

Check

On Linux or Android, WS_OPEN_ERROR_UNDERLYING_IO_OPEN_FAILED with an SDK below 1.48.2 usually comes from its CRL cache. Microsoft says those releases store revocation lists under the issuer name only. Azure certificates now use partitioned CRLs, so the SDK can test a certificate against the wrong list, and OpenSSL ends the handshake.

Check
go list -m github.com/Microsoft/cognitive-services-speech-sdk-go
pip show azure-cognitiveservices-speech

Fix

Move to 1.48.2 or newer; 1.53.1 is current. With Go, update the module and also download the native Linux package again, because the TLS work happens in the native library that the binding calls through cgo. If the upgrade must wait, setting OPENSSL_DISABLE_CRL_CHECK to true is Microsoft's stopgap.

Fix
go get github.com/Microsoft/cognitive-services-speech-sdk-go@v1.53.1
wget -O SpeechSDK-Linux.tar.gz https://aka.ms/csspeech/linuxbinary
tar --strip 1 -xzf SpeechSDK-Linux.tar.gz -C "$SPEECHSDK_ROOT"

// stopgap only, in Go code:
speechConfig.SetPropertyByString("OPENSSL_DISABLE_CRL_CHECK", "true")

Verify

Synthesis returns audio and a fresh log has no Error 44 line. If the app talks to several Azure regions, try each one.

Verify
grep -c "Error 44" /tmp/speech-sdk.log

Confirmed by learn.microsoft.com

Did this fix it?

Cause 2 of 3

OpenSSL on the host has no trusted root certificates where it looks

You seecertificate verify failed appears without Error 44, and the certs folder under OPENSSLDIR is empty or holds a single bundle file

Check

A certificate verify failed line next to WS_OPEN_ERROR_UNDERLYING_IO_OPEN_FAILED means OpenSSL could not build a trusted chain for the Speech host. The SDK uses the system OpenSSL, and Microsoft's Linux guide expects many .crt or .pem files in the certs folder under OPENSSLDIR. One bundle file, as on RHEL, or no files at all needs a fix.

Check
openssl version -d
ls /usr/lib/ssl/certs | head

Fix

Install ca-certificates, which the Speech SDK lists with libssl as a Linux prerequisite. When the certificates live elsewhere, export SSL_CERT_DIR for a folder of files or SSL_CERT_FILE for one bundle before the app starts.

Fix
sudo apt-get update
sudo apt-get install build-essential ca-certificates libasound2-dev libssl-dev wget

# RHEL-style hosts ship one bundle file instead of a folder of files
export SSL_CERT_FILE=/etc/pki/tls/certs/ca-bundle.crt

Verify

The certs folder now lists many certificate files, or the variable points at the bundle, and the next synthesis call completes.

Verify
go run .

Confirmed by learn.microsoft.com

Did this fix it?

Cause 3 of 3

A firewall or proxy blocks the Speech host or the CRL download

You seeThe same build works on a laptop but fails inside a locked-down network, and a plain curl to the resource hangs or is reset

Check

Outbound rules can also end in WS_OPEN_ERROR_UNDERLYING_IO_OPEN_FAILED, either by blocking the Speech endpoint or by blocking the revocation hosts. With CRL checks on, as they are by default in older releases, a CRL that cannot be downloaded counts as an error. Azure serves those lists over HTTP port 80 from DigiCert and microsoft.com names, so allowing *.microsoft.com is not enough.

Check
curl -v --location 'https://YourResourceName.cognitiveservices.azure.com/tts/cognitiveservices/voices/list' \
  --header 'Ocp-Apim-Subscription-Key: YOUR_RESOURCE_KEY' -o /dev/null

Fix

Open HTTPS 443 to the Speech host and port 80 to the CRL and OCSP hosts that Azure's CA page lists. If traffic must leave through a proxy, set it on the config; the Go binding notes that SetProxy does nothing on macOS. Where the CRL hosts stay closed, OPENSSL_CONTINUE_ON_CRL_DOWNLOAD_FAILURE lets the connection go ahead and still logs the failed download.

Fix
// Go: send SDK traffic through your proxy
speechConfig.SetProxy("proxy.example.internal", 8080)

// keep connecting when a CRL cannot be fetched (failures are still logged)
speechConfig.SetPropertyByString("OPENSSL_CONTINUE_ON_CRL_DOWNLOAD_FAILURE", "true")

Verify

The voices list request returns JSON from inside the restricted network, and the synthesizer produces audio there too.

Verify
curl -s 'https://YourResourceName.cognitiveservices.azure.com/tts/cognitiveservices/voices/list' --header 'Ocp-Apim-Subscription-Key: YOUR_RESOURCE_KEY' | head -c 300

Confirmed by learn.microsoft.com

Did this fix it?

How do I stop it coming back?

  • Pin the Speech SDK at 1.48.2 or later in go.mod or requirements.txt, and refresh the native Linux package in the same Docker build step so the two never drift apart.
  • Run the voices list request as a container start-up probe, so a closed egress route fails the deploy instead of the first customer request.
  • Copy the CRL and OCSP host names from Azure's CA details page into your firewall allow-list and recheck its change log when Azure swaps certificate authorities.

Sources

How was this page made?

I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.

Which stack is behind this page?

Projects of mine on the same stack: QistLock, stegnor.com, Menulo.

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.