microsoft / cognitive-services-speech-sdk-js

Microsoft Azure Cognitive Services Speech SDK for JavaScript
Other
252 stars 91 forks source link

[Bug]: Unable to contact server error causes memory leak #795

Closed mohsen-parloa closed 2 months ago

mohsen-parloa commented 4 months ago

What happened?

The ConversationTranslator instance throws [02/21/2024, 4:19:34 PM] Unable to contact server. StatusCode: 1006, undefined Reason: Unexpected server response: 400 randomly, and then the memory usage increases immediately.

these are screenshots from Azure portal, which shows nothing was logged on Azure side:

1

Screenshot 2024-02-21 at 17 46 31

This is how the instance of the class is being created:

const createConversationAsync = (
  speechKey: string | undefined,
  speechRegion: string | undefined,
): Promise<Conversation> => {
  if (speechKey === undefined || speechRegion === undefined) {
    throw new InternalServerErrorException(
      "The Azure speech recognition API key and region were not provided",
    );
  }

  const config = SpeechTranslationConfig.fromSubscription(
    speechKey,
    speechRegion,
  );
  return new Promise((resolve: Callback, reject: Callback) => {
    const conversation = Conversation.createConversationAsync(
      config,
      () => {
        conversation.startConversationAsync(
          () => resolve(conversation),
          reject,
        );
      },
      reject,
    );
  });
};

The image below shows our application memory usage (Node.JS) during this time:

image

At 16:19:34 the memory usage started to go up and then once it reached 4GB (our pod memory limit) at 16:36:10 the pod restarted and the memory usage went down again.

We analyzed the involved code of the Cognitive Services JS SDK, and the behavior is as follows:

Version

1.34.0 (Latest)

What browser/platform are you seeing the problem on?

Node

Relevant log output

No response

glharper commented 2 months ago

This was moved to email, closing.