Azure app service disconnection while calling Azure Open AI service

Iman Saleh 0 Reputation points
2024-09-21T21:26:59.19+00:00

Hi,

I have a problem with an Azure app service deployed to Azure sandbox. I receive the error below in log. The application calls Azure Open AI and there seems to be a problem with chat completion requests. I am unable to debug the problem. I tried the following: increasing the maximum retries of Azure Open AI service to 20 and increasing timeout to 1800 second but this seems to make no difference. The application runs without issues when I make few calls to Azure Open AI service. This problem only happens when the number of chat completion requests increase. Location of open ai service is France central, pricing tier is standard, and model deployment is gpt-4 1106-Preview. Any clue what might cause this problem and how to debug it? This problem occurs only in deployment and when I run the same application locally there seems to be no issue.

2024-09-21T20:55:05.125296883Z File "/home/site/wwwroot/openai_client.py", line 47, in azure_open_ai_call

2024-09-21T20:55:05.125302865Z response = self.client.chat.completions.create(

2024-09-21T20:55:05.125308545Z ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

2024-09-21T20:55:05.125313845Z File "/opt/python/3.12.2/lib/python3.12/site-packages/openai/_utils/_utils.py", line 274, in wrapper

2024-09-21T20:55:05.125319737Z return func(*args, **kwargs)

2024-09-21T20:55:05.125325247Z ^^^^^^^^^^^^^^^^^^^^^

2024-09-21T20:55:05.125330587Z File "/opt/python/3.12.2/lib/python3.12/site-packages/openai/resources/chat/completions.py", line 704, in create

2024-09-21T20:55:05.125336328Z return self._post(

2024-09-21T20:55:05.125341728Z ^^^^^^^^^^^

2024-09-21T20:55:05.125346968Z File "/opt/python/3.12.2/lib/python3.12/site-packages/openai/_base_client.py", line 1268, in post

2024-09-21T20:55:05.125352859Z return cast(ResponseT, self.request(cast_to, opts, stream=stream, stream_cls=stream_cls))

2024-09-21T20:55:05.125358589Z ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

2024-09-21T20:55:05.125364330Z File "/opt/python/3.12.2/lib/python3.12/site-packages/openai/_base_client.py", line 945, in request

2024-09-21T20:55:05.125370572Z return self._request(

2024-09-21T20:55:05.125376764Z ^^^^^^^^^^^^^^

2024-09-21T20:55:05.125382745Z File "/opt/python/3.12.2/lib/python3.12/site-packages/openai/_base_client.py", line 981, in _request

2024-09-21T20:55:05.125388696Z response = self._client.send(

2024-09-21T20:55:05.125394918Z ^^^^^^^^^^^^^^^^^^

2024-09-21T20:55:05.125401149Z File "/opt/python/3.12.2/lib/python3.12/site-packages/httpx/_client.py", line 926, in send

2024-09-21T20:55:05.125407181Z response = self._send_handling_auth(

2024-09-21T20:55:05.125412641Z ^^^^^^^^^^^^^^^^^^^^^^^^^

2024-09-21T20:55:05.125418171Z File "/opt/python/3.12.2/lib/python3.12/site-packages/httpx/_client.py", line 954, in _send_handling_auth

2024-09-21T20:55:05.125424032Z response = self._send_handling_redirects(

2024-09-21T20:55:05.125430474Z ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

2024-09-21T20:55:05.125436476Z File "/opt/python/3.12.2/lib/python3.12/site-packages/httpx/_client.py", line 991, in _send_handling_redirects

2024-09-21T20:55:05.125449430Z response = self._send_single_request(request)

2024-09-21T20:55:05.125455632Z ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

2024-09-21T20:55:05.125461563Z File "/opt/python/3.12.2/lib/python3.12/site-packages/httpx/_client.py", line 1027, in _send_single_request

2024-09-21T20:55:05.125467594Z response = transport.handle_request(request)

2024-09-21T20:55:05.125473515Z ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

2024-09-21T20:55:05.125479036Z File "/opt/python/3.12.2/lib/python3.12/site-packages/httpx/_transports/default.py", line 236, in handle_request

2024-09-21T20:55:05.125485327Z resp = self._pool.handle_request(req)

2024-09-21T20:55:05.125491589Z ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

2024-09-21T20:55:05.125497219Z File "/opt/python/3.12.2/lib/python3.12/site-packages/httpcore/_sync/connection_pool.py", line 216, in handle_request

2024-09-21T20:55:05.125503551Z raise exc from None

2024-09-21T20:55:05.125509433Z File "/opt/python/3.12.2/lib/python3.12/site-packages/httpcore/_sync/connection_pool.py", line 196, in handle_request

2024-09-21T20:55:05.125515514Z response = connection.handle_request(

2024-09-21T20:55:05.125521144Z ^^^^^^^^^^^^^^^^^^^^^^^^^^

2024-09-21T20:55:05.125527106Z File "/opt/python/3.12.2/lib/python3.12/site-packages/httpcore/_sync/connection.py", line 101, in handle_request

2024-09-21T20:55:05.125533317Z return self._connection.handle_request(request)

2024-09-21T20:55:05.125538938Z ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

2024-09-21T20:55:05.125544138Z File "/opt/python/3.12.2/lib/python3.12/site-packages/httpcore/_sync/http11.py", line 143, in handle_request

2024-09-21T20:55:05.125550009Z raise exc

2024-09-21T20:55:05.125555379Z File "/opt/python/3.12.2/lib/python3.12/site-packages/httpcore/_sync/http11.py", line 113, in handle_request

2024-09-21T20:55:05.125561220Z ) = self._receive_response_headers(**kwargs)

2024-09-21T20:55:05.125566620Z ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

2024-09-21T20:55:05.125572691Z File "/opt/python/3.12.2/lib/python3.12/site-packages/httpcore/_sync/http11.py", line 186, in _receive_response_headers

2024-09-21T20:55:05.125579213Z event = self._receive_event(timeout=timeout)

2024-09-21T20:55:05.125585014Z ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

2024-09-21T20:55:05.125590575Z File "/opt/python/3.12.2/lib/python3.12/site-packages/httpcore/_sync/http11.py", line 224, in _receive_event

2024-09-21T20:55:05.125596236Z data = self._network_stream.read(

2024-09-21T20:55:05.125601535Z ^^^^^^^^^^^^^^^^^^^^^^^^^^

2024-09-21T20:55:05.125606945Z File "/opt/python/3.12.2/lib/python3.12/site-packages/httpcore/_backends/sync.py", line 126, in read

2024-09-21T20:55:05.125612526Z return self._sock.recv(max_bytes)

2024-09-21T20:55:05.125617966Z ^^^^^^^^^^^^^^^^^^^^^^^^^^

2024-09-21T20:55:05.125630069Z File "/opt/python/3.12.2/lib/python3.12/ssl.py", line 1233, in recv

2024-09-21T20:55:05.125635609Z return self.read(buflen)

2024-09-21T20:55:05.125641060Z ^^^^^^^^^^^^^^^^^

2024-09-21T20:55:05.125646339Z File "/opt/python/3.12.2/lib/python3.12/ssl.py", line 1106, in read

2024-09-21T20:55:05.125652050Z return self._sslobj.read(len)

2024-09-21T20:55:05.125657360Z ^^^^^^^^^^^^^^^^^^^^^^

2024-09-21T20:55:05.125662790Z File "/opt/python/3.12.2/lib/python3.12/site-packages/gunicorn/workers/base.py", line 203, in handle_abort

2024-09-21T20:55:05.125668511Z sys.exit(1)

2024-09-21T20:55:05.125673901Z SystemExit: 1

Azure OpenAI Service
Azure OpenAI Service
An Azure service that provides access to OpenAI’s GPT-3 models with enterprise capabilities.
3,084 questions
Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
7,780 questions
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.