Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to initialize platform (azure-c-shared). Error: 2176 #2204

Closed
xeo545x39 opened this issue Jan 6, 2024 · 22 comments
Closed

Failed to initialize platform (azure-c-shared). Error: 2176 #2204

xeo545x39 opened this issue Jan 6, 2024 · 22 comments
Labels
duplicate This issue or pull request already exists

Comments

@xeo545x39
Copy link

I've updated .NET to 8.0 and moved to Docker and now I cannot use Speech service anymore due to this error when creating SpeechSynthesizer class instance.

Stacktrace:

System.ApplicationException: Runtime error: Failed to initialize platform (azure-c-shared). Error: 2176
2024-01-06T17:53:47.649086302Z    at Microsoft.CognitiveServices.Speech.Internal.SpxExceptionThrower.ThrowIfFail(IntPtr hr)
2024-01-06T17:53:47.649089762Z    at Microsoft.CognitiveServices.Speech.SpeechSynthesizer.FromConfig(SpeechConfig speechConfig)
2024-01-06T17:53:47.649092962Z    at Microsoft.CognitiveServices.Speech.SpeechSynthesizer..ctor(SpeechConfig speechConfig)

Speech log file:

[631194]: 4ms SPX_DBG_TRACE_VERBOSE:  resource_manager.cpp:133 Created 'CSpxThreadService' as '303073113'
[631194]: 4ms SPX_DBG_TRACE_VERBOSE:  resource_manager.cpp:133 Created 'CSpxThreadService' as '303073113'
[631194]: 4ms SPX_TRACE_WARNING: resource_manager.cpp:141 Failed to create 'CSpxCodecAdapter' as '199052375'. Are all required extension libraries loaded?
[631194]: 4ms SPX_DBG_TRACE_VERBOSE:  usp_tts_engine_adapter.cpp:60 CSpxUspTtsEngineAdapter
[631194]: 4ms SPX_DBG_TRACE_VERBOSE:  resource_manager.cpp:133 Created 'CSpxUspTtsEngineAdapter' as '919101823'
[631194]: 4ms SPX_TRACE_ERROR: AZ_LOG_ERROR:  shim_openssl.c:55 libssl could not be loaded
[631194]: 4ms SPX_TRACE_ERROR: AZ_LOG_ERROR:  tlsio_openssl.c:2175 Could not load libssl
[631194]: 4ms SPX_TRACE_ERROR:  exception.cpp:130 About to throw Runtime error: Failed to initialize platform (azure-c-shared). Error: 2176 
[CALL STACK BEGIN]

/app/runtimes/linux-x64/native/libMicrosoft.CognitiveServices.Speech.core.so(+0x1decbb) [0x7ece7c5decbb]
/app/runtimes/linux-x64/native/libMicrosoft.CognitiveServices.Speech.core.so(+0x207afd) [0x7ece7c607afd]
/lib/x86_64-linux-gnu/libc.so.6(+0x8dea7) [0x7f0fd1a35ea7]
/app/runtimes/linux-x64/native/libMicrosoft.CognitiveServices.Speech.core.so(+0x208c2e) [0x7ece7c608c2e]
/app/runtimes/linux-x64/native/libMicrosoft.CognitiveServices.Speech.core.so(+0x1b9c7b) [0x7ece7c5b9c7b]
/app/runtimes/linux-x64/native/libMicrosoft.CognitiveServices.Speech.core.so(+0x1b9531) [0x7ece7c5b9531]
/app/runtimes/linux-x64/native/libMicrosoft.CognitiveServices.Speech.core.so(+0x1e5c5d) [0x7ece7c5e5c5d]
/app/runtimes/linux-x64/native/libMicrosoft.CognitiveServices.Speech.core.so(+0x1cabf6) [0x7ece7c5cabf6]
/app/runtimes/linux-x64/native/libMicrosoft.CognitiveServices.Speech.core.so(+0x1dba0e) [0x7ece7c5dba0e]
/app/runtimes/linux-x64/native/libMicrosoft.CognitiveServices.Speech.core.so(+0xf28a5) [0x7ece7c4f28a5]
/app/runtimes/linux-x64/native/libMicrosoft.CognitiveServices.Speech.core.so(+0x1e5c5d) [0x7ece7c5e5c5d]
/app/runtimes/linux-x64/native/libMicrosoft.CognitiveServices.Speech.core.so(+0x1d2a1f) [0x7ece7c5d2a1f]
/app/runtimes/linux-x64/native/libMicrosoft.CognitiveServices.Speech.core.so(+0x21619a) [0x7ece7c61619a]
/app/runtimes/linux-x64/native/libMicrosoft.CognitiveServices.Speech.core.so(synthesizer_create_speech_synthesizer_from_config+0xf3) [0x7ece7c4bd331]
[0x7f0f58dd9aad]
[CALL STACK END]


[631194]: 4ms SPX_DBG_TRACE_VERBOSE:  usp_tts_engine_adapter.cpp:65 ~CSpxUspTtsEngineAdapter: this=0x0x7ece6c0cbf60
[631194]: 4ms SPX_DBG_TRACE_SCOPE_ENTER:  synthesizer.cpp:42 ~CSpxSynthesizer
[631194]: 4ms SPX_DBG_TRACE_VERBOSE:  create_object_helpers.h:78 SpxTerm: ptr=0x0x7ece6c1ca168
[631194]: 4ms SPX_DBG_TRACE_SCOPE_ENTER:  thread_service.cpp:45 Term
[631194]: 4ms SPX_DBG_TRACE_SCOPE_EXIT:  thread_service.cpp:45 Term
[631194]: 4ms SPX_DBG_TRACE_VERBOSE:  create_object_helpers.h:78 SpxTerm: ptr=0x0x7ece6c1c9a78
[631194]: 4ms SPX_DBG_TRACE_SCOPE_EXIT:  synthesizer.cpp:42 ~CSpxSynthesizer
[631194]: 4ms SPX_DBG_TRACE_SCOPE_ENTER:  thread_service.cpp:45 Term
[631194]: 4ms SPX_DBG_TRACE_SCOPE_EXIT:  thread_service.cpp:45 Term
[631194]: 4ms SPX_DBG_TRACE_SCOPE_ENTER:  thread_service.cpp:45 Term
[631194]: 4ms SPX_DBG_TRACE_SCOPE_EXIT:  thread_service.cpp:45 Term
[631194]: 4ms SPX_DBG_TRACE_VERBOSE:  handle_table.h:111 CSpxHandleTable::TrackHandle p=0x0x7ece6c1ca200
[631194]: 4ms SPX_DBG_TRACE_VERBOSE:  handle_table.h:121 CSpxHandleTable::TrackHandle class=ExceptionWithCallStack, h=0x0x7ece6c1ca200, p=0x0x7ece6c1ca200, tot=1
[631194]: 4ms SPX_RETURN_ON_FAIL:  speechapi_c_factory.cpp:566 hr = 0x7ece6c1ca200
[631194]: 4ms SPX_DBG_TRACE_SCOPE_EXIT:  speechapi_c_factory.cpp:556 synthesizer_create_speech_synthesizer_from_config
[631194]: 5ms SPX_DBG_TRACE_VERBOSE:  handle_table.h:180 CSpxHandleTable::StopTracking(h) h=0x0x7ece6c1ca200
[631194]: 5ms SPX_DBG_TRACE_VERBOSE:  handle_table.h:195 CSpxHandleTable::StopTracking(h) class=ExceptionWithCallStack, h=0x0x7ece6c1ca200, p=0x0x7ece6c1ca200, tot=0

To Reproduce

Steps to reproduce the behavior:

  1. Create Docker container based on latest ASP.NET 8.0 image:
    8.0.0-bookworm-slim-amd64, 8.0-bookworm-slim-amd64, 8.0.0-bookworm-slim, 8.0-bookworm-slim, 8.0.0, 8.0, latest Dockerfile Debian 12 12/19/2023
  2. Run container
  3. Create SpeechSynthesizer object

Expected behavior

Object should be created and I can access Speech Service.

Version of the Cognitive Services Speech SDK

Nuget:
Microsoft.CognitiveServices.Speech 1.34.0

Azure Resource:
Standard Speech Service based on Norh Europe
https://northeurope.api.cognitive.microsoft.com/

Platform, Operating System, and Programming Language

  • OS: Docker, image based on latest ASP.NET 8.0
  • Programming language: C#
@VersaXu
Copy link

VersaXu commented Jan 8, 2024

I have encountered the same error message, with AWS serverless, anyone could help on this? Thanks.

@muralidhar972
Copy link

muralidhar972 commented Jan 8, 2024

I have encountered the same error message while working in colab. looking forward for help. thanks
below is the error screen shot
image

@rhurey
Copy link
Member

rhurey commented Jan 9, 2024

Both failures are the azure-c-shared library used as the networking stack by the SDK failing to load because the version of OpenSSL it binds to (1.1.1) isn't installed.

There is a workstream to support OpenSSL 3.0 in progress, but it isn't complete yet.

@muralidhar972
Copy link

@rhurey is there any alternative solution at the moment.

@jbennink
Copy link

jbennink commented Jan 9, 2024

@rhurey is there any alternative solution at the moment.

I can't do it, but I guess a workaround would be building a base container yourself based on a distro that still has openssl1.1.1 available. then install openssl 1.1.1 and de net8 runtime and use that instead of mcr.microsoft.com/dotnet/net:8.0

@muralidhar972
Copy link

muralidhar972 commented Jan 9, 2024

@rhurey or @jbennink : do we have any stable version to test. it would be more help full, without docker image part and i got this error while testing in colab directly.

@rhurey
Copy link
Member

rhurey commented Jan 10, 2024

@muralidhar972 We don't have packages available for preview yet.

@boskjoett
Copy link

I am using the Speech SDK in a docker container running on .NET 8.
Here is my workaround, which installs libssl 1.1.1

FROM mcr.microsoft.com/dotnet/aspnet:8.0

# Install prerequisites for Azure Speech Services
# See https://docs.microsoft.com/en-us/azure/cognitive-services/speech-service/quickstarts/setup-platform
RUN apt-get update
RUN apt-get -y install build-essential libssl-dev libasound2 wget

# Next four lines are needed in order to be able to run on .NET 8.0
# until this issue is fixed by Microsoft: https://github.com/Azure-Samples/cognitive-services-speech-sdk/issues/2204
# These lines will install OpenSSL 1.1.1 which is needed by the Speech SDK.
RUN wget http://nz2.archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1f-1ubuntu2.20_amd64.deb
RUN dpkg -i libssl1.1_1.1.1f-1ubuntu2.20_amd64.deb

RUN wget http://nz2.archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl-dev_1.1.1f-1ubuntu2.20_amd64.deb
RUN dpkg -i libssl-dev_1.1.1f-1ubuntu2.20_amd64.deb

@jbennink
Copy link

jbennink commented Jan 10, 2024

EDIT: Forget what I said. I was having some more strange problems, then updated Docker Desktop, which hung, then decided to reboot my computer and now it works :-( Why is Windows only getting worse

@Vilabella
Copy link

I have the same issue using a Python image.
Does anybody know how to work around this with a python image?

@donaldhughes
Copy link

donaldhughes commented Jan 18, 2024

This issue seems to be avoided by making REST API calls directly instead of using the SDK.

@mediarl
Copy link

mediarl commented Jan 25, 2024

Same problem with Python here. I could use the REST API but I wanted to use the streaming feature that is only available with SDK.

@jinzishuai
Copy link

jinzishuai commented Feb 6, 2024

following https://gist.github.com/joulgs/c8a85bb462f48ffc2044dd878ecaa786?permalink_comment_id=4720594 to install libssl1.1_1.1.0g-2ubuntu4_amd64.deb and it is working now

╰─❯ dpkg -l |grep libssl
ii  libssl-dev:amd64                           3.0.2-0ubuntu1.14                       amd64        Secure Sockets Layer toolkit - development files
ii  libssl1.1:amd64                            1.1.0g-2ubuntu4                         amd64        Secure Sockets Layer toolkit - shared libraries
ii  libssl3:amd64                              3.0.2-0ubuntu1.14                       amd64        Secure Sockets Layer toolkit - shared libraries
ii  libssl3:i386                               3.0.2-0ubuntu1.14                       i386         Secure Sockets Layer toolkit - shared libraries

Copy link

This item has been open without activity for 19 days. Provide a comment on status and remove "update needed" label.

@github-actions github-actions bot added the update needed For items that are in progress but have not been updated label Feb 26, 2024
@JoeBerg8
Copy link

any update on the openssl3.0 upgrade?

@github-actions github-actions bot removed the update needed For items that are in progress but have not been updated label Feb 28, 2024
@pankopon
Copy link
Contributor

pankopon commented Mar 7, 2024

Duplicate of #2048

@pankopon pankopon marked this as a duplicate of #2048 Mar 7, 2024
@pankopon pankopon closed this as completed Mar 7, 2024
@pankopon pankopon added the duplicate This issue or pull request already exists label Mar 7, 2024
@boyko11
Copy link

boyko11 commented Apr 12, 2024

This one got it going in my python:3.12.2 image. Credit to @boskjoett

# The following two RUNs install OpenSSL 1.1.1 without which Azure SDK errors in docker
# Update and install necessary packages
RUN apt-get update && apt-get install -y \
    wget \
    libasound2

# Install OpenSSL 1.1.1f
RUN wget http://security.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1f-1ubuntu2.22_amd64.deb \
    && dpkg -i libssl1.1_1.1.1f-1ubuntu2.22_amd64.deb \
    && wget http://security.ubuntu.com/ubuntu/pool/main/o/openssl/libssl-dev_1.1.1f-1ubuntu2.22_amd64.deb \
    && dpkg -i libssl-dev_1.1.1f-1ubuntu2.22_amd64.deb

# Cleanup to reduce image size
RUN apt-get clean && rm -rf /var/lib/apt/lists/* \
    && rm *.deb

@waveBoom
Copy link

This one got it going in my python:3.12.2 image. Credit to @boskjoett这个在我的 python:3.12.2 图像中得到了它。归功于@boskjoett

# The following two RUNs install OpenSSL 1.1.1 without which Azure SDK errors in docker
# Update and install necessary packages
RUN apt-get update && apt-get install -y \
    wget \
    libasound2

# Install OpenSSL 1.1.1f
RUN wget http://security.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1f-1ubuntu2.22_amd64.deb \
    && dpkg -i libssl1.1_1.1.1f-1ubuntu2.22_amd64.deb \
    && wget http://security.ubuntu.com/ubuntu/pool/main/o/openssl/libssl-dev_1.1.1f-1ubuntu2.22_amd64.deb \
    && dpkg -i libssl-dev_1.1.1f-1ubuntu2.22_amd64.deb

# Cleanup to reduce image size
RUN apt-get clean && rm -rf /var/lib/apt/lists/* \
    && rm *.deb

This one got it going in my python:3.12.2 image. Credit to @boskjoett这个在我的 python:3.12.2 图像中得到了它。归功于@boskjoett

# The following two RUNs install OpenSSL 1.1.1 without which Azure SDK errors in docker
# Update and install necessary packages
RUN apt-get update && apt-get install -y \
    wget \
    libasound2

# Install OpenSSL 1.1.1f
RUN wget http://security.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1f-1ubuntu2.22_amd64.deb \
    && dpkg -i libssl1.1_1.1.1f-1ubuntu2.22_amd64.deb \
    && wget http://security.ubuntu.com/ubuntu/pool/main/o/openssl/libssl-dev_1.1.1f-1ubuntu2.22_amd64.deb \
    && dpkg -i libssl-dev_1.1.1f-1ubuntu2.22_amd64.deb

# Cleanup to reduce image size
RUN apt-get clean && rm -rf /var/lib/apt/lists/* \
    && rm *.deb

Great, it worked
This is a temporary solution, because Microsoft is too inefficient (this problem is probably more than a year old), and if you want to solve it, you can only do it this way
Or change to restapi

@TheBicPen
Copy link

A word of warning for that workaround: it may work in a container, but will probably break your system if you do it outside a container. Installing a conflicting version of a package on your real system is very dangerous.

@xmkevin
Copy link

xmkevin commented May 22, 2024

Both failures are the azure-c-shared library used as the networking stack by the SDK failing to load because the version of OpenSSL it binds to (1.1.1) isn't installed.

There is a workstream to support OpenSSL 3.0 in progress, but it isn't complete yet.

Is it available now ?

@aikitty123
Copy link

Is there an older version of the azure-c-shared library we could use that works? I don't care about having the latest version, just that it works.

@TBThomas56
Copy link

I am using the Speech SDK in a docker container running on .NET 8. Here is my workaround, which installs libssl 1.1.1

FROM mcr.microsoft.com/dotnet/aspnet:8.0

# Install prerequisites for Azure Speech Services
# See https://docs.microsoft.com/en-us/azure/cognitive-services/speech-service/quickstarts/setup-platform
RUN apt-get update
RUN apt-get -y install build-essential libssl-dev libasound2 wget

# Next four lines are needed in order to be able to run on .NET 8.0
# until this issue is fixed by Microsoft: https://github.com/Azure-Samples/cognitive-services-speech-sdk/issues/2204
# These lines will install OpenSSL 1.1.1 which is needed by the Speech SDK.
RUN wget http://nz2.archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1f-1ubuntu2.20_amd64.deb
RUN dpkg -i libssl1.1_1.1.1f-1ubuntu2.20_amd64.deb

RUN wget http://nz2.archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl-dev_1.1.1f-1ubuntu2.20_amd64.deb
RUN dpkg -i libssl-dev_1.1.1f-1ubuntu2.20_amd64.deb

Hi! I tried to replicate this with a python environment and openssl seems to not be installing. For anyone else who is interested, , my DockerFile is the following

ARG PYTHON_VERSION=3.11
FROM python:${PYTHON_VERSION} as developer


FROM mcr.microsoft.com/dotnet/aspnet:8.0

# Install prerequisites for Azure Speech Services
# See https://docs.microsoft.com/en-us/azure/cognitive-services/speech-service/quickstarts/setup-platform
RUN apt-get update
RUN apt-get -y install build-essential libssl-dev libasound2 wget
RUN apt-get install -y --no-install-recommends \
graphviz \
&& rm -rf /var/lib/apt/lists/*


# New and updated link
RUN wget http://archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.0g-2ubuntu4_amd64.deb
RUN dpkg -i libssl1.1_1.1.0g-2ubuntu4_amd64.deb



RUN python -m venv /venv
ENV PATH=/venv/bin:$PATH

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests